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)
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)
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
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.