Heres my code(Not working)
workspace.corridor.Monster.EyeHitbox.Touched:Connect(function(hit)
local Character = game.StarterPlayer.StarterCharacterScripts
Character:WaitForChild("Humanoid").Running:Connect(function(speed)
if speed > 0.1 then -- Walking
print("Walking")
else -- Idle
print("Standing")
end
end)
end)
My code doesnt work, can someone explain why and fix it?
Answer:
workspace.corridor.Monster.EyeHitbox.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local Humanoid = hit.Parent:WaitForChild("Humanoid")
if Humanoid.MoveDirection.Magnitude > 0 then
plr:Kick("Dont move")
else
print("Player survived")
end
end)