Hi guys, as stated in the title, what parameters were stored inside of "tool.Equipped:connect(function(Entity) end)"? I was trying some really simple stuff like printing the name of the player who've equipped that tool without using localscript. It seems that it returns "nil" here's what I did:
Placed a tool consisting of a script, and a part named "Handle" , inside of starter pack. Here's my code:
tool = script.Parent --Refers to the tool itself
handle = tool.Handle --Refers to the part named "Handle"
tool.Equipped:connect(function(Entity)
local player = Entity.Parent --Parent of the equipped tool should be the player right?
print(Entity.Name) --This should display name of player
end)
The above code prints out "Instance"
When using something like game.Workspace.Part.Touched:connected(function(Entity) end), it seems to be storing the parameters of whichever entity that triggers this event as a variable of sorts inside "Entity", hence I can do something like:
game.Workspace.Part.Touched:connected(function(**Entity**)
print(Entity.Name) --Displays the whatever legs touching the part
--And if i want to display the username--
local player = Entity.Parent
print(player)
end)

1 comment
Like he said, it's the Mouse. Mouse is nil on the server, because mouses are client-side objects. If you use a LocalScript, you can get the player via game.Players.LocalPlayer