Hi!
Basically, when I put the tool in Workspace the animations work, however when I put it in StarterPack or ServerStorage and give it to myself it does not work.
Script:
local plr = game.Players.LocalPlayer
local anims = {script.Parent.Hold, script.Parent.Swing}
local loadedAnims = {}
local tool = script.Parent
local animator
local debounce = true
local del = 2
tool.Equipped:Connect(function()
script.Parent.Handle.Transparency = 1
end)
tool.Equipped:Connect(function(mouse) --On tool equipped do:
animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
if not loadedAnims[1] then --If the animation wasn't loaded before
loadedAnims[1] = animator:LoadAnimation(anims[1]) --Load it
end
loadedAnims[1]:Play() --Play it
end)
--Click animation:
tool.Activated:Connect(function()
if(debounce) then --Setting up the debounce (cooldown)
debounce = false
animator = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator") --Find the animator object
if(not loadedAnims[2]) then --If the animation didn't exist yet
loadedAnims[2] = animator:LoadAnimation(anims[2]) --Load it
end
loadedAnims[2]:Play() --Play it
wait(del) --Wait the cooldown
debounce = true
end
end)
tool.Unequipped:Connect(function()
loadedAnims[1]:Stop()
if(loadedAnims[2]) then
loadedAnims[2]:Stop()
end
end)
Any help is appreciated, thanks!
Local scripts cant work in serverstorage
2 Likes
How would I modify the localscript to work as a server side script?
ill suggest using remote event or remote functions and if you want to understand it ill fix this to give you an example
well also move the tool to replicated storage because like i told you local script wont work
actually can i get the model to fix this i like to test it out to make it perfectly work since im not so good either with remotes
1 Like
Sure, here’s the model:
animation.rbxm (4.2 KB)
thx man now ill just use that to fix your tool
1 Like
If it is not too rude to ask, how are you going to fix it?
Using a bit of remote events and remote functions im working on it but one thing puzzles me
Alright, is there any way I can know when it can be fixed?
umm about an hour or 30 minutes depending on how broken it will be because im still having some trouble
@Falcon_Aviator is this yours or did you take it out of the toolbox? cause why this?
tool.Equipped:Connect(function(mouse)
-- you dont need that if your not gonna set it or use that arg in any case in that function
It was from an old devforum post, why?
old devforum post do you still have the link is it deleted
That’s weird ! Did the same thing for me aswell ! I put a weapon, months ago, in the ReplicatedStorage and the animation won’t work ! (I took many weapons from the toolbox and I tried and would not work with them.) Sorry for the useless reply but I want to told you that you are not the only one who met this problem.
likely because FE or an error with the animation code
The post was deleted for being in the wrong category, but is there any present fix?
yes there is ill give you the fix in a second
Sounds great, thanks again for this.