so this code:
local particle = part:FindFirstChild("ParticleEmitter")
local sound = part:FindFirstChild("Break bones #4")
local Player = game:GetService("Players")
local players
Player.PlayerAdded:Connect(function(player)
players = player
end)
local teams = game:GetService("Teams")
local team1 = teams:FindFirstChild("Viking Brutes")
local team2 = teams:FindFirstChild("Vikings")
local team3 = teams:FindFirstChild("Viking Archers")
local Ttable = {team1 , team2 , team3}
local canTouch = true
local SPEED
part.Touched:Connect(function(hit)
local canDo = true
for _, p in ipairs(players:GetChildren()) do
if p.Team == team1 or p.Team == team2 or p.Team == team3 then
canDo = false
break
end
end
if canTouch and canDo == true then
local character = hit:FindFirstAncestorOfClass("Model")
if not character then return end
sound:Play()
if particle then
particle.Transparency = NumberSequence.new(0)
task.delay(1, function()
particle.Transparency = NumberSequence.new(1)
end)
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Sit then return end
local player = game.Players:GetPlayerFromCharacter(character)
local originalJumpPower = humanoid.JumpPower
local originalWalkSpeed = humanoid.WalkSpeed
local function getSpeed()
SPEED = humanoid.WalkSpeed
end
getSpeed()
humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
humanoid.Sit = true
humanoid.JumpPower = 0
humanoid.WalkSpeed = 0
local forceSit = true
local sitLoop = task.spawn(function()
while forceSit and humanoid and humanoid.Parent do
humanoid.Sit = true
task.wait()
end
end)
canTouch = false
task.wait(3)
canTouch = true
humanoid.JumpPower = originalJumpPower
humanoid.WalkSpeed = SPEED
humanoid.Sit = false
task.cancel(sitLoop)
end
end)
worked up until the moment i added the for loop to check if ur in one of said teams, now after i added it, it doesnt work at all
also another issue is that after 3 seconds pass it doesn't restore ur speed back to what it did befoer
** You are now Level 2! **