New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Animation gets stuck/looped forever on other players screens?

Asked by 5 days ago
Edited 5 days ago

So I have a movement script that plays an animation when pressing W twice and increases walk speed. It also changes the walking animation.

For some reason, the animation gets stuck in a loop on other players screens, you will be infinitely running in place. I think this has to do with the server script, and the animation not being stopped there.

The animation gets stuck at random times, sometimes when you first run, sometimes when you spawn, other times it doesn't happen for a little while.

The Local Script is in starter character scripts, and there is 2 remote events and 2 scripts inside of it. The local script calls upon the server scripts to start running, and to stop running. I used remote events as I wanted everyone to see the animations.

local script

local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local input = game:GetService("UserInputService")
local animation = "http://www.roblox.com/Asset?ID=3779207769"
local stop = false
local cd = 0.25

local WalkSpeedBuff = 25

local isRunning = false

input.InputBegan:Connect(function(Input, IsTyping)
    if IsTyping then return end
    if isRunning then return end
    if char.HumanoidRootPart.Anchored == true then return end
    if Input.KeyCode == Enum.KeyCode.W then
        if not stop then
            stop = true
            wait(cd)
            stop = false
        else
            isRunning = true
            script.run:FireServer()
        end
    end
end)

input.InputEnded:Connect(function(Input, IsTyping)
    if IsTyping then return end
    if isRunning == true then
        if Input.KeyCode == Enum.KeyCode.W then
script.norun:FireServer()
        isRunning = false

        end
    end
end)

remote event script 1

script.Parent.run.OnServerEvent:Connect(function(plr)
    local char = plr.Character or plr.CharacterAdded:Wait()
    local input = game:GetService("UserInputService")
    local animation = "http://www.roblox.com/Asset?ID=3779207769"
            char.Animate.walk.WalkAnim.AnimationId = animation
            char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + 15
            wait(1)
            char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed + 0
            wait(0.5)
end)

remote event script 2

script.Parent.norun.OnServerEvent:Connect(function(plr)
    local char = plr.Character or plr.CharacterAdded:Wait()
    local input = game:GetService("UserInputService")
    local animation = "http://www.roblox.com/Asset?ID=3779207769"
        char.Humanoid.WalkSpeed = char.Humanoid.WalkSpeed - 15
        char.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=3779207769"
end)
0
yo i really want to know when this works can i use it btw speedyfox66 93 — 4d

Answer this question