I'm trying to make a script in which when you click on a SurfaceGUI button, it makes the "box" belong to that player. To do this I need to change some values to equal the player's name. The only problem is finding the player. I'm not sure how to find the player after clicking (You might've seen my (player) After the function, that was me trying to find it). Anyway can someone please help? Here's the script:
boxsettings = script.Parent
frame = script.Parent.Parent
bin = script.Parent.Parent.Parent
boxsettings.MouseButton1Click:connect(function(player)
if boxsettings.Text == "Claim Box!" then
boxsettings.Text = "Box Settings"
frame.Owner.Value = player.Name
frame.CurrentOwner.Text = "Current owner: "..player.Name
end
end)
