Okay, so I have a overhead Gui. Everything is working great, except for one thing. I'll give the problem scenario:
Player A joins and can edit the Gui Text and Visible values with a TextBox and TextButton.
Player B joins, and can do the same. However, when Player A tries to edit their values after Player B joins, they edit Player B's values instead of their own.
Server Script:
local repStorage = game:GetService('ReplicatedStorage') local remoteOne = repStorage:FindFirstChild('Remote') local remoteTwo = repStorage:FindFirstChild('RemoteTwo') local iFolder = script:WaitForChild('Items') local compile = iFolder:WaitForChild('Compile') require(compile) local compiled = iFolder:WaitForChild('Overhead') game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) if Character:FindFirstChild('Humanoid') and Character:FindFirstChild('Head') then local Hum = Character:WaitForChild('Humanoid') local Head = Character:WaitForChild('Head') Hum.DisplayDistanceType = ('None') comClone = compiled:Clone() comClone.Parent = Head comClone.Data.Text = Player.Name end end) end) -- This remote event cooresponds to the custom name script. remoteTwo.OnServerEvent:Connect(function(Player, enterName) comClone.Data.Text = enterName end) -- The remote event cooresponds to the name toggle. remoteOne.OnServerEvent:Connect(function(Player) if comClone.Data.Visible == true then comClone.Data.Visible = false else comClone.Data.Visible = true end end)
Local Script:
local repStorage = game:GetService('ReplicatedStorage') local Players = game:GetService('Players') local uis = game:GetService('UserInputService') local remoteOne = repStorage:FindFirstChild('Remote') local remoteTwo = repStorage:FindFirstChild('RemoteTwo') local playerGui = Players.LocalPlayer:FindFirstChild('PlayerGui'):FindFirstChild('screenGui') -- The gui toggle function. playerGui.toggleGUI.MouseButton1Click:Connect(function() if playerGui.main.Visible == false then playerGui.main.Visible = true else playerGui.main.Visible = false end end) -- The name toggle function. Changes Data.Visible to true. playerGui.main.toggleName.MouseButton1Click:Connect(function() remoteOne:FireServer() end) -- The enter name function. It connects to the overheadName server script. playerGui.main.enterName.FocusLost:Connect(function(enterPressed) if enterPressed then remoteTwo:FireServer(playerGui.main.enterName.Text) end end)