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

Item Equipped Click Play Animation?

Asked by 7 years ago
Edited 7 years ago

How would i make it that when a certain item is equipped, the player clicks and an animation plays?

(putting the script in Server Script Service)

(i'm not asking for a script just how to put the script together)

1 answer

Log in to vote
0
Answered by
laripo 17
7 years ago
Edited 7 years ago

You need to have the Click and Equipped functions in your script and I'll give an example of what you can do.

--Equipped function
--You would have a boolean variable for when the tool is equipped

local ToolEquipped = false --Your boolean variable 

Tool.Equipped:connect(function() -- OnEquip Function
    ToolEquipped = true
end)

Tool.Unequipped:connect(function() -- OnUnequip Function
    ToolEquipped = false
end)

Tool.Activated:connect(function(mouse)
    if ToolEquipped then
        --Animation script here
    end
end)

Now I haven't tested it, it many not work but it's what I did for my sword. I think you can also simply put the mouseClicked event in the Equipped function.

0
I think there's a property in the Tool's API that checks if it's equipped or not, so you shouldn't have to make a variable. Scriptecx 124 — 7y
Ad

Answer this question