Hello Guys,
I have a weapon and I also made an animation for the tool and I wanted to ask how can I script it so that he holds the weapon like the animation and walks too the animation normally.
He holds the gun up.
Greetings
Hello Guys,
I have a weapon and I also made an animation for the tool and I wanted to ask how can I script it so that he holds the weapon like the animation and walks too the animation normally.
He holds the gun up.
Greetings
you can do something like:
local tool = script.Parent
local anim = tool.YourAnimNameOrlOcation
local char = game.Players.LocalPlayer.Character
local humanoid = char:FindFirstChild("Humanoid")
tool.Equipped:Connect(function()
humanoid:LoadAnimation(anim)
anim:Play()
end)
LoadAnimation returns a animation track which you use :Play() on
local tool = script.Parent
local anim = tool.YourAnimNameOrlOcation
local char = game.Players.LocalPlayer.Character
local humanoid = char:FindFirstChild("Humanoid")
tool.Equipped:Connect(function()
local track = humanoid:LoadAnimation(anim)
track:Play()
end)
Oh yeah i mean that i forgot thanks for correcting me
Hello Guys,
Thanks for the Help.
So i did that and there stand in the output that the Animation is not a valid member of Localscript.
Bro,
Put the thing in the tool and actually use the script than rather other people do everything for you but,
Get the script in the tool local script, then define the animation, get the path of the anim , can be in the tool for example and ur done
He didnt. For some reason, local scripts dont work if the animation is directly under the script. Put the animation inside the tool, then reference it from there.
I wouldnt jump to conclusions very quick, as you forget a few things (which is what happened)
Animations on Roblox have always been wonky with how they work, but I believe this is true.
Getting animations takes a lot of patience and learning, I recommend searching the docs to find how they work and learn from them instead of jumping to the dev forum to ask. Do some research, and come back so you can understand what others on this post are talking about.
It would look something like this.
local tool = script.Parent
local anim = tool.YourAnimNameOrlOcation
local char = game.Players.LocalPlayer.Character
local humanoid = char:FindFirstChild("Humanoid")
tool.Equipped:Connect(function()
local track = humanoid:LoadAnimation(anim)
track:Play()
end)
NOT like this
local tool = script.Parent
local anim = script.YourAnimNameOrlOcation
local char = game.Players.LocalPlayer.Character
local humanoid = char:FindFirstChild("Humanoid")
tool.Equipped:Connect(function()
local track = humanoid:LoadAnimation(anim)
track:Play()
end)
Bro, maybe you should read it again but slower
Im sorry, but maybe you shouldve worded it better. I didnt understand “Put the THING in the tool”. Please. for future reference, be more polite and more clear in your instructions.
Put the thing as in put the local script or client sided script in the tool
Again, I believe you didnt clarify the location of the animation. This is what caused the problem.
It has nothing to do with it, if u could read then u couldve read:
local tool = script.Parent
local anim = tool.YourAnimNameOrlOcation
im not trying to be rude but i worded it rude
I dont feel like respoding to impolite replies, but again, when the problem arose, you didnt tell them why it was caused. They didnt know that animations didnt work if they were below a local script, then you called them out for just slapping scripts into things.
But now that the problem has been addressed, we can move on from this and wait to see if the OP’s problem is fixed.
Yes i agree, im sorry for being so rude/ unpolite or childish what ever, lets hope what he asked for is fixed
I believe the OP is new to handling animations via scripting or new to scripting in general, some fault on the op’s end for jumping straight to the forums without reading the docs but I believe a brief break down of how it works and explained what was wrong would be nice.
Hello Guys,
Thank you for your fast answers.
Your Right you can’t use Animations inside a LocalScript i know that.
I dont know much stuff about animations thats the reason i ask.
So my Friend did a Mistake in the Animation that was the Output Mistake im Sorry for that.
Thank You Guys for your Help
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.