How can I make this animation run?

So what I want is that when a player touches a part an animation plays on them without them being able to move so the animation or cutscene isn’t ruined. So what I did is I tried to load the animation and make the playerwalkspeed 0 but that doesn’t work so any solutions on how I can make the animation play while they cant move?

please watch both videos

local Trigger = game.Workspace.Trigger
local player = game.Players.LocalPlayer
local DB = false

Trigger.Touched:Connect(function(hit)
local Humanoid = hit.Parent:WaitForChild(“Humanoid”)
if Humanoid ~= nil then
local Animation = game.ReplicatedStorage:WaitForChild(“Animation”)
if DB == false then
DB = true
local Clone = Animation:Clone()
Clone.Parent = hit.Parent
local Dance = Humanoid:LoadAnimation(Clone)
Dance:Play()
Humanoid.WalkSpeed = 0
wait(3)
Humanoid.WalkSpeed = 16
end
end
end)

Try anchoring the player’s HumanoidRootPart. Animations will still be able to run but the player will be frozen until you unanchor it, or they reset.

also, make sure you use the code formatting (the little </> icon) when posting your scripts!

YES thank you it works! and will do!

1 Like