Hey!
Since you are always going to be handling any user input on the client (LocalScript), we can use Players.LocalPlayer
to find the local player, and in this situation, the player clicking the button. An example of this is shown below...
1 | local Player = game.Players.LocalPlayer |
3 | script.Parent.MouseButton 1 Click:Connect( function () |
4 | script.Parent.Parent.PlayerStats [ Player ] .BackgroundColor 3 = Color 3. fromRGB( 0 , 255 , 0 ) |
5 | game.ReplicatedStorage.Values.PlayersReady.Value = game.ReplicatedStorage.Values.PlayersReady.Value + 1 |
6 | script.Parent.Visible = false |
A tip for people that are relatively new: you can't use LocalPlayer
on the server. This is because, well, code that runs on the server is ran on the server, and code that's ran on the client is ran on the client (your computer).
Hope this helped! If it did, please remember to upvote and mark as answered.