The local script is in a tool, and when you activate it (click) then it will get the player who clicks. When i try to print the player who clicks it returns as nil in output. Any ideas?
script.Parent.Activated:Connect(function(plr) print(plr) end)
thanks for any help
The problem is there is no such property (or whatever you call it) in this event so you can't get a Player
by this method. Since it is in a local script, all you need to do is to replace 'player' to game.Players.LocalPlayer
so you want this code below.
script.Parent.Activated:Connect(function() print(game.Players.LocalPlayer) -- likejagar end)
If I understand what you trying to do, you will face some issues (but I don't really know why you need this). If you have some problems with this, just ask me in the comments below.
script.Parent.Activated:Connect(function(player) print(player.Name) end)