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

How do i make when i play animation walkspeed will be 0 and every script will disable?

I want to make my script that a punch animation when I press a key button the animation will play every script will disable and can't move anything?

Sorry For My Grammar.

local player = game.Players.LocalPlayer
local db = true
local damage = false

local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset?id=3641946843"

game.Players.LocalPlayer.Character:WaitForChild("RightHand").Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and not db and not damage and hit.Parent.Humanoid ~= game.Players.LocalPlayer.Character.Humanoid then
        if game.Players.LocalPlayer.Character.Humanoid.Health > 0 then
            damage = true
            game.ReplicatedStorage.Punch:FireServer(hit.Parent.Humanoid)
        end
    end
end)

game:GetService("UserInputService").InputBegan:Connect(function(input, event)
    if input.KeyCode == Enum.KeyCode.E and db then
        db = false
        local playAnim = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):loadAnimation(anim)
        playAnim:Play()
        wait(0.8)
        damage = false
        db = true
    end
end)

1 answer

If you want to make local players walkspeed 0, then you can make RemoteEvent, FireServer and make passed players walkspeed 0.

I just don't understand which scripts do you want to disable and why

3 comments

0

all script disable cause if i use sprint script animation will cancle

0

make object boolValue called AnimIsplaying and make it true when anymation playes, make sprint script to check constantly if AnimIsPlaying is true, and if it si it should now make player sprint, in other words it should only make player run, if AnimIsPlaying is false

0

make object boolValue called AnimIsplaying and make it true when anymation playes, make sprint script to check constantly if AnimIsPlaying is true, and if it si it should now make player sprint, in other words it should only make player run, if AnimIsPlaying is false

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