Hi, so I’ve been trying to make a hammer that has to charge before being able to smash/strike. If that makes sense.
Here’s my attempt so far and the animations sometimes work and sometimes not.
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local charge = script.Charge
local smash = script.Smash
local chargeTrack = humanoid:LoadAnimation(charge)
local smashTrack = humanoid:LoadAnimation(smash)
local charging = false
local charged = false
tool.Activated:Connect(function()
chargeTrack:Play()
if not charging then
charging = true
wait(2.9) --chargeTrack is 3 seconds long, that's why.
chargeTrack:AdjustSpeed(0)
end
end)
tool.Deactivated:Connect(function()
if charging then
charging = false
chargeTrack:Stop()
smashTrack:Play()
end
end)
Is there any other more efficient way of doing this? Please help, thanks much.