local spawnloc = script.Parent.Name script.Parent.CurrentOwner.Changed:Connect(function() if script.Parent.CurrentOwner.Value == BrickColor.new("Bright blue") then game.StarterGui.SpawnGui.Frame.Flag1.BackgroundColor3 = Color3.new(85/255, 170/255, 255/255) for i,v in pairs(game.Players:GetChildren()) do v.PlayerGui:FindFirstChild("SpawnGui").Frame:FindFirstChild(spawnloc).BackgroundColor3 = Color3.new(85/255, 170/255, 255/255) end elseif script.Parent.CurrentOwner.Value == BrickColor.new("Bright red") then game.StarterGui.SpawnGui.Frame.Flag1.BackgroundColor3 = Color3.new(255/255, 80/255, 80/255) for i,v in pairs(game.Players:GetChildren()) do v.PlayerGui:FindFirstChild("SpawnGui").Frame:FindFirstChild(spawnloc).BackgroundColor3 = Color3.new(255/255, 80/255, 80/255) end elseif script.Parent.CurrentOwner.Value == BrickColor.new("Fossil") then game.StarterGui.SpawnGui.Frame.Flag1.BackgroundColor3 = Color3.new(207/255, 207/255, 207/255) for i,v in pairs(game.Players:GetChildren()) do v.PlayerGui:FindFirstChild("SpawnGui").Frame:FindFirstChild(spawnloc).BackgroundColor3 = Color3.new(207/255, 207/255, 207/255) end end end)
This script doesn't work in a server script, it doesn't change the player's GUI for some reason, so how would I turn this into a remote event script to work?
-- In a Server Script local RemoteEvent = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage")) local CurrentOwner = -- whatever it is CurrentOwner.Changed:Connect(function(NewValue) RemoteEvent:FireAllClients(NewValue) -- fires the remote event to everyone when it changes ) -- In a Local Script in the GUI local GUI = script.Parent local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") local function OnCurrentOwnerChange(NewValue) GUI.Frame.Flag1.BackgroundColor3 = NewValue.Color -- you can get the Color3 from a BrickColor by referring to its .Color for i,v in pairs(game.Players:GetChildren()) do GUI.Frame:FindFirstChild(spawnloc).BackgroundColor3 = NewValue.Color end end RemoteEvent.OnClientEvent:Connect(OnCurrentOwnerChange)
Note that I don't recommend actually making new RemoteEvents in Scripts themselves - a better option would be to make one in Studio with the appropriate name (such as CurrentOwnerChanged) then refer to that in the scripts instead.
This is not a perfect solution but I hope you get the idea.