Color change of overhead billboard GUI appears for the client but no other players / not the server

I have an already working system where users can change 2 billboard GUIs above their heads for both their “name” and “description”.
I wanted to add a feature where they can change the color of this text to a few simple options, and while it works for the player’s point of view, the color change doesn’t appear for anyone else. I know it’s probably because I used a localscript for it, but I genuinely don’t know how else I would go about doing it, as I’m nowhere near an experienced or even decent scripter.
Each button for a color option has the following code in a localscript(which calls on the background and border color of the buttons so that I didn’t have to manually enter in every color code):

local player = game:GetService("Players").LocalPlayer
local colorrequested = script.Parent.BackgroundColor3
local borderrequested = script.Parent.BorderColor3

script.Parent.MouseButton1Down:connect(function()
	local Head = player:FindFirstChild("Head")
	local text = player.Character.Head.name.TextLabel
	player.Character.Head.name.TextLabel.TextColor3 = colorrequested
	player.Character.Head.description.TextLabel.TextColor3 = colorrequested
	player.Character.Head.name.TextLabel.TextStrokeColor3 = borderrequested
	player.Character.Head.description.TextLabel.TextStrokeColor3 = borderrequested
	wait(5)
end)

The script in storagescriptservice for the name text (the description text is basically the same):

game.Players.ChildAdded:connect(function(player)
	local name = Instance.new("StringValue")
	name.Name = "RPName"
	name.Value = player.Name
	name.Parent = player
	
	player.CharacterAdded:connect(function(char)
		char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None  
		
		local bill = Instance.new("BillboardGui", char.Head)
		bill.Name = "name"
		bill.Adornee = char.Head
		bill.Size = UDim2.new(1,0,1,0,0,0)
		bill.StudsOffset = Vector3.new(0,2.5,0)
		bill.MaxDistance = 90
		bill.AutoLocalize = true
		bill.DistanceLowerLimit = 0
		bill.DistanceUpperLimit = 20

		local text = Instance.new("TextLabel")
		text.Parent = bill
		text.Text = name.Value
		text.FontSize = "Size12"
		text.Size = UDim2.new(1,0,1,0,0,0)
		text.BackgroundTransparency = 1
		text.TextColor3 = BrickColor.new("White").Color
		text.TextStrokeColor3 = BrickColor.new("Black").Color
		text.TextStrokeTransparency = 0
		text.AutoLocalize = true

		name.Changed:connect(function(newName)
			text.Text = newName
		end)
	end)
end)

local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage.ChangeName

event.OnServerEvent:connect(function(player, newName)
	player:findFirstChild("RPName").Value = newName
end)

I’ve tried making remoteevents for all the colors and making the serverscript change the text color based on that, but that made pressing a color button change the name color for ALL players.

I’m guessing I need some sort of remotefunction or remoteevent for the color to change serverside, but I don’t know how to make those work (the reason for it being in the name text script is that it was grabbed from a tutorial). How should I go about doing this?

You are right about this. The way you would get around this (replicating the color change to the server) would be to change it on a server script instead of the local one. You can still accept their input on the localscript (and this would be necessary if they’re choosing the color from UI), but you need to send the info about that change through a remote event.

So, for example:

local colorrequested = script.Parent.BackgroundColor3
local borderrequested = script.Parent.BorderColor3
local ChangeColor = game:GetService("ReplicatedStorage").ChangeColor -- a remote event

script.Parent.MouseButton1Down:connect(function()
    ChangeColor:FireServer(colorrequested, borderrequested)
end)

And then in a server script (like the one you already have):

local ChangeColor = game:GetService("ReplicatedStorage").ChangeColor

ChangeColor.OnServerEvent:Connect(function(player, colorrequested, borderrequested)
    local Head = player.Head
	local text = player.Character.Head.name.TextLabel
	player.Character.Head.name.TextLabel.TextColor3 = colorrequested
	player.Character.Head.description.TextLabel.TextColor3 = colorrequested
	player.Character.Head.name.TextLabel.TextStrokeColor3 = borderrequested
	player.Character.Head.description.TextLabel.TextStrokeColor3 = borderrequested
end)

The first argument on a remote event will be the player that sent the request, so your original code still works here. My syntax may not be perfect as I can’t test this right now, but the idea is there!

Worked great + was able to adapt it how I wanted. Honestly didn’t know you could transfer localscript data to serverscript like that. Thank you!! =)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.