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

How do i make an aimation for a model like a sword play when someone clicks while holding the sword?

Asked by
jlc272 4
4 years ago

How do i make my sword do my sword animation when i click while holding the sword, or any other sword?

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

use this model as you can move the script and animation to any other tool and shouldn't cause any issues (model made by me) https://web.roblox.com/library/6707600197/animation-tool-template

0
It did not work jlc272 4 — 4y
0
i just made a model that should work CatastrophicDinosaur 4 — 4y
Ad
Log in to vote
0
Answered by
mroaan 95
4 years ago
Edited 4 years ago

from my understanding you want to play an animation when he click while equipping a tool so firstly insert a local script inside any tool you want and then write this script:

01local tool = script.Parent -- the tool
02local player = game.Players.LocalPlayer -- the player
03local newAnim = Instance.new("Animation",script) -- we insert an animation inside the script
04newAnim.AnimationId = "rbxassetid://animationID" -- change animationID to your animationID
05local char = player.Character or player.CharacterAdded:Wait() -- the character of the player
06local debounce = true -- debounce
07tool.Activated:Connect(function() -- activated event fires when the player clicks while equipping the tool
08    if debounce == true then -- checks if debounce is true
09        debounce = false -- we set it to false so the animation doesnt keep on re-playing
10        local animtrack = char.Humanoid:LoadAnimation(newAnim) -- the animation track to play
11        animtrack:Play() -- playing it
12        debounce = true -- after the animation finishes we set debounce back to true
13    end
14end)

Answer this question