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?