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

Why won't the sword swing animation play in a regular Roblox game?

Asked by 4 years ago

Hi, so I'm trying to script a sword with animations, and it works perfectly fine in studio, even when doing the multiplayer test, but when I enter the actual Roblox client, it won't play the animations, the sword still detects me clicking on the server script (which deals damage), so I know thats working. The local script could't be doing anything for all I know. Heres the code:

In the serverScript:

function OnClick()
    if script.Parent.Attacking.Value == false then
        script.Parent.Attacking.Value = true
        wait(0.75)
        script.Parent.Attacking.Value = false
    end
end
function touch(hit)
    if script.Parent.Hitting.Value == false then
        if script.Parent.Attacking.Value == true then

            hit.Parent.EnemyHumanoid.Health = hit.Parent.EnemyHumanoid.Health - 10
            script.Parent.Hitting.Value = true
            wait(0.75)
            script.Parent.Hitting.Value = false

        end
    end

end
script.Parent.Handle.Touched:Connect(touch)
script.Parent.Activated:Connect(OnClick)

And in the localScript:

print("scriptready")
function Equip()

    Anim = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Animation)
    print("Anim Loaded")


end
function onClick()
    print("Checking")
    if script.Parent.Attacking.Value == false then
        print("Click")
        Anim:Play()
        wait(0.75)
        Anim:Stop()
        print("finished")


    end


end

script.Parent.Equipped:Connect(Equip)
script.Parent.Activated:Connect(onClick)

Any help wpuld be usefull, thanks.

0
would* be helpful pengalu200 65 — 4y
0
Try usinging pcalls to see what went wrong emervise 123 — 3y
0
Lol I figured it out sorry pengalu200 65 — 3y

Answer this question