Problem with invite system

Im making an invite system to invite them to a party and when they click on invite a gui pops up for the player.

When i click invite the gui doesnt pop up because i dont know how to replace player with text.

ex.
i have local InviteTo = script.Parent.Text
and want to replace game.Players.LocalPlayer to InviteTo

InvitePrompt.OnClientEvent:Connect(function(player, InviteTo)
    game.Players.LocalPlayer.PlayerGui.Teams.Invited.Visible = true
    game.Players.LocalPlayer.PlayerGui.Teams.Invited.TextLabel.Text = player.Name .. " has invited you to their party"
end)
InvitePrompt.OnClientEvent:Connect(function(player, InviteTo)
	InviteTo.PlayerGui.Teams.Invited.Visible = true
	InviteTo.PlayerGui.Teams.Invited.TextLabel.Text = player.Name .. " has invited you to their party"
end)

but it doesnt work and i have no errors

LocalPlayer is a read only property.

image

I’m not sure what you’re trying to do, but here’s what you need to do:

Note that in actual code, this would look more like:

i have a gui that gets all player names and set the textlabel text and name to the player name.
i have an invite button that sends the players name to a remote event and then to a client event so that i could use the textlabel name to replace game.Players.LocalPlayer to then make the gui visible.

I think it doesn’t work because one client cannot set another client object

details