Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Make Character stay still while animation plays?

Asked by 4 years ago

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?

0
put their walkspeed and jumppower to 0? Pupppy44 671 — 4y
0
how would i do that for a specific time? Fauxriii 8 — 4y
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. User#30567 0 — 4y
0
Post your WHOLE script. User#30567 0 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Ad
Log in to vote
0
Answered by
ae_su -5
4 years ago

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
0
hmmm doesn't seem to work? Fauxriii 8 — 4y
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) Fauxriii 8 — 4y
0
Why do you have line 3 when you have line 2 User#30567 0 — 4y

Answer this question