Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Make Character stay still while animation plays?

I'm trying to create a simulator, and when my animation plays and the character moves, it looks weird, so is there some script i could use to make the player not be able to jump or move for a 1.25 seconds?

4 comments

0

put their walkspeed and jumppower to 0?

0

how would i do that for a specific time?

1

https://bfy.tw/OoOz This is a tutorial on google searching. It will help you search thousands of websites to help your find what you need.

0

Post your WHOLE script.

2 answers

✓ Accepted answer

This is an implementation:

local hum = script.Parent.Parent.Humanoid
local track = hum:LoadAnimation(anim) 
track.Priority = Enum.AnimationPriority.Action 
track.Looped = false 
local previousSpeed, previousJumpPower
local debounce = false
tool.Activated:Connect(function() 
	if not debounce then
		debounce = true
		previousSpeed = hum.WalkSpeed
		previousJumpPower = hum.JumpPower
		track:Play() 
		Humanoid.WalkSpeed = 0
		Humanoid.JumpPower = 0
		wait(1.25)
		Humanoid.WalkSpeed = previousSpeed
		Humanoid.JumpPower = previousJumpPower
		debounce = false
	end
end) 
tool.Unequipped:Connect(function() 
		track:Stop() 
		Humanoid.WalkSpeed = previousSpeed
		Humanoid.JumpPower = previousJumpPower
		debounce = false
end)

This changes the WalkSpeed and JumpPower and reverts it later on

Changing WalkSpeed and JumpPower via Humanoid should do it

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
repeat wait() until Character
local Humanoid = Character:WaitForChild("Humanoid")
local Delay = 1.25

-- Your Script Here
wait(Delay)
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
wait(Delay)
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 50

3 comments

0

hmmm doesn't seem to work?

0

my script is very basic, local track tool.Activated:Connect(function() track = script.Parent.Parent.Humanoid:LoadAnimation(anim) track.Priority = Enum.AnimationPriority.Action track.Looped = false track:Play() end) tool.Unequipped:Connect(function() if track then track:Stop() end end)

0

Why do you have line 3 when you have line 2

This discussion is preserved as it was. New answers, comments, and votes are closed.