Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

? Script only works sometimes. Trying to make a Billboard Script. Please Help! ?

Hello! Sorry to bother you today but I am making a script where when I or one of my friends join the game, then a billboard GUI pops up on top of their head. The problem with this script is that it works sometimes but then other times it doesn't work. Here is the script.

local player = game:GetService("Players")
local playersName = {"ShortTeamROBLOX", "BadBoyManJg"}
local OwnerBill = game:GetService("ServerStorage"):WaitForChild("OwnerBill")


player.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		for _, v in pairs(playersName) do
			if plr.Name == v then
				local OwnerBillClone = OwnerBill:Clone()
				print("One of the devs of the game has joined the game!")
				OwnerBillClone.StudsOffset = Vector3.new(0, 2, 0)
				OwnerBillClone.Parent = char:FindFirstChild("Head")
				OwnerBillClone.Adornee = char:FindFirstChild("Head")
				OwnerBillClone.OwnerLabel.Text = "Developer"
				local function changeColor()
					while true do
						OwnerBillClone.OwnerLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
						wait(1)
						OwnerBillClone.OwnerLabel.TextColor3 = Color3.fromRGB(255, 139, 44)
						wait(1)
						OwnerBillClone.OwnerLabel.TextColor3 = Color3.fromRGB(255, 248, 29)
						wait(1)
						OwnerBillClone.OwnerLabel.TextColor3 = Color3.fromRGB(6, 232, 6)
						wait(1)
						OwnerBillClone.OwnerLabel.TextColor3 = Color3.fromRGB(23, 112, 255)
						wait(1)
						OwnerBillClone.OwnerLabel.TextColor3 = Color3.fromRGB(161, 114, 255)
						wait(1)
						OwnerBillClone.OwnerLabel.TextColor3 = Color3.fromRGB(237, 94, 255)
						wait(1)
					end
				end
				changeColor()
			end
		end
	end)
end)

If you have a solution, please feel free to comment below. Stay safe!

1 comment

0

Try :WaitForChild("Head")

1 answer

✓ Accepted answer

You can try :WaitForChild("Head") instead of :FindFirstChild("Head"), because the Head takes time to load in.

5 comments

1

Oh, okay I will try that in a few hours and comment back to see if ot works! Thanks.

1

It works 90% of the time so that will do. Thank you for answering my question!

0

No Problem! you can also add the max amount time it will wait by doing like

0

No Problem! you can also add the max amount time it will wait by doing like :WaitForChild("Head",10) -- 10 seconds

1

Oh, I see. Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.