Username on Label

So I was making a whiteboard where you click the buttonlabel and it places the players username who clicked it to the button text, but if someone else clicks it, it uses the first persons username. What did I do wrong in my script? It’s a server script so people can see whos username is on the board

Main issue:
Player1 clicks and places their user
Player 2 clicks and it uses player1’s username instead of player2’s

button = script.Parent.SurfaceGui.TextLabel
player = game:GetService("Players").PlayerAdded:Wait()
sound = script.Parent["writing sound"]

button.MouseButton1Click:Connect(function()
	button.Text = player.Name
	sound:Play()
end)
1 Like

is this server or client sided

1 Like

Nvm just look at @Dev_Peashie’s post this post is now incorrect

1 Like

If this is a server script, you cannot use the GUI button to trigger that signal, unless you give a client script to the players and send a remote to the server.

Another approach is get rig of the GUI button and place a part with a clickDetector so the server can listen that input instead of the GUI button

2 Likes

You need to make the script client-sided and then use a remote event to request the server to change the label.

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