So when using a click detector with filtering enabled on the click detector doesn't return the player who clicked it. Here's my code,
script.Parent.ClickDetector.MouseClick:connect(function(plr) print(plr) end)
The output would be nil when testing this on a server. How would you get the player? I've tried using remote events but obviously I can't get the player so that failed. Is there another way of getting the player or am I just doing something wrong?
ClickDetectors do work in FE. For some reason I can't get print statements to print.
If you want to for example give the player a tool when he clicks you need to use a remote event to access the players backpack.
Remote events should be stored in ReplicatedStorage.
If you are giving the player a tool you would do
ServerScript
script.parent.ClickDetector.MouseClick:connect(function(player) game.ReplicatedStorage.RemoteEvent:FireClient(player) end)
Now on the players side you would need to have a listener for the client event. LocalScript
function name() -- The code that gives the player said tool end game.ReplicatedStorage.RemoteEvent.OnClientEvent:connect(name)
You can read more on events here: RemoteEvents
Make sure you scroll down to the see also section and read those too.
That will be a big help when you are building your FE game.
Hope this helped.
I just want to necrobump this, this is so simple. Sorry! The answer is, that you're printing a "object" to the console. Remember to always put it like this while printing it to the console
print(plr.Name)
Yet, sorry!