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

Animation on equip works on local server testing but not on game?

Asked by 6 years ago

It works on local server 2 players, when I equip a tool the equip animation plays and pauses (so a pose is achieved on equip) and stops on unequip (goes back to normal position). It works on local server testing but not on actual game... The script:

wait(3)
local tool = script.Parent -- use local variables
local Player = game.Players.LocalPlayer --get the local player
local isitEquipped = Player.hasWeapon
local getName = Player.Name
local attack = workspace:FindFirstChild(getName).Humanoid:LoadAnimation(script.equipAnimation)

tool.Equipped:Connect(function(mouse) -- :Connect not :connect, :connect is deprecated
    isitEquipped.Value = true
    attack:Play()
    wait(attack.Length - 0.1)
    attack:AdjustSpeed(0)
end)

tool.Unequipped:Connect(function()
    isitEquipped.Value = false
    local idle = workspace:FindFirstChild(getName).Humanoid:LoadAnimation(script.Idle)
    attack:AdjustSpeed(1)
    wait(0.1)
    attack:Stop()
end)
0
Filter enabled... Use remote events, have the tool.Equipped fire a remote event, and then in serverscriptservice, add the part which gives the player the animation. oggy521 72 — 6y
0
The thing is, it works on another place (my testing place which I tried to publish to roblox). But does not work on the game I want it to work on (also published) :/ xxXTimeXxx 101 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

okay :connect isnt deprecated but make it a local script and put it in StarterPlayer,StarterCharacterScripts also make sure whenever u call Player and its referring to local player always do

if Player ~= nil then
--code here
end

or else the console will say your attempting to call a nil value and disable your script

0
The thing is, it works on another place (my testing place which I tried to publish to roblox). But does not work on the game I want it to work on (also published) :/ xxXTimeXxx 101 — 6y
Ad

Answer this question