Same Gui, but separate for every player

Hi, I want to make a gui where you can edit the the text on part(Achieved), but I also want different players to have there own gui, but it the same one. I think it will create lag i I make multiple different Guis.

When the player edits their own part, it goes to all the other parts which I don’t want.

I did search up on the devforum, but I didn’t see nothing I wanted.

My local script inside frame:

--Localscript
local remoteEvent = game:GetService("ReplicatedStorage").EditMessage
local EditButtonUi = game.Players.LocalPlayer.PlayerGui:WaitForChild("EditingUi").EditButton

script.Parent.DoneButton.MouseButton1Click:Connect(function()
	remoteEvent:FireServer("name", script.Parent.GameName.Text)
	remoteEvent:FireServer("description", script.Parent.Description.Text)
	game.Players.LocalPlayer.PlayerGui:WaitForChild("EditingUi").EditGui.Visible = false
	EditButtonUi.Visible = true
end)

remoteEvent.OnClientEvent:Connect(function(type_, message)
	if type_ == "name" then
		workspace.MainParts.Main2.SurfaceGui.GameNameLabel.Text = message
	elseif type_ == "description" then
		workspace.MainParts.Main2.SurfaceGui.GameDescriptionLabel.Text = message
	end
end)

Thank you.

1 Like

just change the ui through a local script so only you can see it and you dont need remotes

How Do I Change It Through A Local Script?

Okay first, just create a Local Script! Then, copy the script and paste it into the Local Script. Local Script’s Icon have a person in it, is different with Normal Script.

Normally, Local Script is used for StarterGUI! Is for the local player.

What Script does in GUI

Script is for global player. Is kinda like if someone click a button and another frame will bump up, the others player which is in the same player who click the button will also see a frame bump up.

What Local Script does in GUI

Local Script is for local player which is for the player who click a button and a frame will bump up. But remember local player mean the 1 person only, So, the player who click the button will only see the frame bump up. The others won’t see the frame bump up from their screen.

That’s why normally we use Local Script to make Open and Close Button for GUI

It did help, though I think this is also causing the problem:

--Server
local remoteEvent = game:GetService("ReplicatedStorage").EditMessage

game.Players.PlayerAdded:Connect(function(player)
	script.Parent.Parent.ClickDetector.MouseClick:Connect(function(player)
		player.PlayerGui:WaitForChild("EditingUi").EditGui.Visible = true
	end)
end)

remoteEvent.OnServerEvent:Connect(function(player, type_, message)
	remoteEvent:FireAllClients(type_, game:GetService("Chat"):FilterStringForBroadcast(message, player)) --Send our message back to all clients.
end)
2 Likes