Hello again!
It is my second post today and I am now here to ask, why does my code not work?
It is a script to make a billboard gui textlabel text change, but it doesn’t work.
Optional, because that would make sure even when the character isnt loaded yet, it’d wait.
local Players = game:GetService("Players")
local Jug = Players.LocalPlayer
local Char = Jug.Character or Jug.CharacterAdded:Wait()
local Head = Char:FindFirstChild("Head")
local Tag = Head:WaitForChild("BillboardGui")
script.Parent.MouseButton1Click:Connect(function()
Tag.TextLabel.Text = "Your Text"
Tag.TextLabel.TextStrokeColor3 = Color3.fromRGB(255,0,0)
end)
[I suggest avoid naming instances with classes’ names]
How is the player going to click a part if he hasnt spawned lmao. You are just complicating it. You arent wrong to have the check but that isnt the problem with his code
local Players = game:GetService("Players")
local Jug = Players.LocalPlayer
local Char = Jug.Character or Jug.CharacterAdded:Wait()
local Head = Char:FindFirstChild("Head")
local Tag = Head:WaitForChild("BillboardGui")
script.Parent.MouseButton1Click:Connect(function()
Tag.TextLabel.Text = "Your Text"
Tag.TextLabel.TextStrokeColor3 = Color3.fromRGB(255,0,0)
end)
Here, try this.
As I’ve suggested above already.
One of the issues I saw, was that you tried to assign TextStrokeColor3 as a string value, instead of a Color3 value.
TL;DR: please stop trolling and listen to everyone’s answers. Sometimes they will make random things like text = ..., which means that its a replacement. next time, copy and paste your script instead of making an image of it, as it will save time and your disk space. all the time you were copying and pasting script answers without making necessary adjustments, which consumed an unnecessary amount of time for people who are trying to help you solve your issue. A reminder is that common sense exists, so try to use it if possible.
the script below can help:
local jugador = game:GetService("Players").LocalPlayer --yield script
script.Parent.MouseButton1Click:Connect(function()
workspace[jugador.Name].Head:WaitForChild("BillboardGui").TextLabel.Text = "hospital worker" --common sense
workspace[jugador.Name].Head:WaitForChild("BillboardGui").TextLabel.TextStrokeColor3 = Color3.fromRGB(255, 0, 0) --you never used color3
end)