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

equip animation for Gun not Working. Help?

Asked by 5 years ago
Edited 5 years ago

i have a lot of trouble with remote events, and i'm making a equip animation for a gun, can you guys correct me pls??

local player = game:GetService("Players").LocalPlayer
local equip_anima = script.Parent:WaitForChild("Equip")
equip_anima.OnServerEvent:Connect(function()
    local animaequip = equip_anima:WaitForChild("Equiping")
    local animaequiptrack = player.Character:WaitForChild("Humanoid"):LoadAnimation(animaequip)
    animaequiptrack:Play()
end)
0
i dont see anywhere where "player" is defined. it should be the parameter of "OnServerEvent". it wouldnt hurt to make better variable names either! Gey4Jesus69 2705 — 5y
0
just putting this out there for you, but the whole point of variables is so that you can assign a long line of code or something to a short variable. So what that means is don't make a variable name that is almost as long as the line of code you're trying to simplify. SteamG00B 1633 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

If this is an animation for a thing such as a tool, for example, you don't need to use RemoteEvents to play an animation client-sided. Below, is a simplified client-sided animation player:

local player = game:GetService("Players").LocalPlayer
local equipAnim = script.Parent:WaitForChild("Equip"):WaitForChild("Equiping")

local equipTrack = player.Character:WaitForChild("Humanoid"):LoadAnimation(equipAnim)
equipTrack:Play()

If you need any other help, just reply to this answer. :)

-Crystal

Ad

Answer this question