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
3 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 3 years ago
Edited 3 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 — 3y
0
i just made a model that should work CatastrophicDinosaur 4 — 3y
Ad
Log in to vote
0
Answered by
mroaan 95
3 years ago
Edited 3 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:

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

Answer this question