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

How can i make a animation play on click?

Asked by
notfenv 171
5 years ago

So basically a starting player has this tool called pushup, They equip it and Anim0 plays. (which is like in push up pose but not doing it and this is r15)

Whenever they click, Anim1 Plays, Anim 1 is the pushup, then they gain +1 Strength (Leaderstats int. value)

local tool = script.Parent
local event = game.ReplicatedStorage.StrengthEvent
local debounce = false

tool.Activated:Connect(function()
if not debounce then
debounce = true
event:FireServer()
wait(1)
debounce = false
end    
end)

tool = script.Parent
local sword = true
tool.Activated:Connect(function()
    if sword == false then return end
    sword = false
    local char = tool.Parent
    local hum = char.Humanoid

    local anim = hum:LoadAnimation(script.Parent.Anim0)
    anim:Play()
    wait(1)
    sword = true
        local anim = hum:LoadAnimation(script.Parent.Anim1)
    anim:Play()
    wait(1)
    sword = true
end)

Please note that the animations are in the tool, not the handle, and please put your examples in answers, i cannot understand through comments.

Answer this question