Like Title says, but not a script like:
function onEquip
"Blah blah blah"
something.Equipped:connect(onEquip)
But a Script like:
script.Parent.Equipped:connect(function(...
I don't know how to do that, thnaks for the help
Like Title says, but not a script like:
function onEquip
"Blah blah blah"
something.Equipped:connect(onEquip)
But a Script like:
script.Parent.Equipped:connect(function(...
I don't know how to do that, thnaks for the help
What you are trying to create is something called an anonymous function, a function that does not have a direct identifier, or name.
You can only use these kinds of functions with built-in ROBLOX events, such as Equipped or Touched.
yourTool.Equipped:connect(function()
--Code for when the Tool is equipped.
end)
That would be the same thing as
function onEquipped()
--Code for when the Tool is equipped.
end
yourTool.Equipped:connect(onEquipped)
But in a less amount of lines.
Here is the Wiki page on anonymous functions so you can read more about them.
If I helped you out, be sure to accept my answer!
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Oh, I thought the Way I wanted was a faster way, thanks!
They both do the exact same thing. One just takes up less lines.