Hey,
I’ve got a trap script, but it won’t work!
The player can’t move, but the player won’t spin.
In the while loop, I try to make my player spin. The player doesn’t spin!
Here is my script:
local Trap = script.Parent
local Open = Trap.Open
local Closed = Trap.Open.Close
local HitBox = Open.Hitbox
local Connection
Connection = HitBox.Touched:Connect(function(Hit)
--print('touched')
if Hit.Parent:FindFirstChild('Humanoid') then
--print('Found humanoid')
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
local Humanoid = Hit.Parent.Humanoid
local HRP = Hit.Parent.HumanoidRootPart
local Animation = Humanoid:LoadAnimation(workspace.TrappedAnimation)
if not Player:FindFirstChild('DogeTag') then
--print('is not the doge')
Connection:Disconnect()
Hit.Parent.Humanoid:TakeDamage(35)
Hit.Parent.Humanoid.Died:Connect(function()
script.Parent:Destroy()
end)
Humanoid.JumpPower = 0
Humanoid.WalkSpeed = 0
Open.Stunned:Play()
Open.Transparency = 1
Closed.Transparency = 0
local NoCoolDown = true
coroutine.resume(coroutine.create(function()
while NoCoolDown do
HRP.Orientation += Vector3.new(0,.2,0)
wait(.2)
end
end))
wait(10)
NoCoolDown = false
Humanoid.JumpPower = 40
Humanoid.WalkSpeed = 16
end
end
end)
I get no errors at all, thanks for any help!