Server Script not detecting player

It’s not printing the player, help
parent is a textbutton

script.Parent.MouseButton1Down:Connect(function()
	print("t")
	local players = game:GetService("Players")
	local player = players.PlayerAdded:Wait()
	print(player.Name)
end)

Is this in a script or a local script?

its in the title, but this is a server script,

iirc, :wait doesn’t return anything. use players.PlayerAdded:Once(function(player) … end) instead.

i tried that, it doesnt work either

then there is something else wrong. that should 100% work

check for errors and use prints to make sure your script is running.

why do you think i went here, i did everything

no prints no errors just quiet lmao

If this is a server script then MouseButton1Down wont work.

That is only useable on client.

oh really? never knew that, well what can i use instead then

A local script.
They are the only scripts that can do that kind of stuff.
And if you need to still do stuff on the server you can fire a remote event from the client to the server

Happy to help!
~Froyo~

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.