LocalScript not running at all

Hello. I’ve been trying to make a simple GUI that checks the players badges. After starting to make each icon for each badge individually, I decided on making a shortcut placed in each icon to automatically find the color for each icon based on it’s text. In the script, I first start with getting a table of the children in Lighting, then I check if it’s class name is a Part (it’s a merge game lol) I then check if the icon’s text is equal to the part’s name. If all checks out, it simply changes it’s background color to the same color of the block. It’s not working at all, in fact even after writing print lines for each step, it doesn’t print anything. The GUI is enabled and the script is entirely local. What is the issue here?

icon = script.Parent
text = script.Parent.Text
player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
print("player loaded")

for index, child in pairs (game.Lighting:GetChildren()) do
	print("getting a table of lighting's children")
	if child.ClassName == "Part" then
		print("child is a part, moving on")
		if child.Name == text then
			print("child's name = the icon's text")
			icon.BackgroundColor3 = child.Color
		end
	end
end
1 Like

Where is the local script located?

2 Likes


It’s right there. (yes I know there’s a lot of text labels)

1 Like

seems like the player’s character was already added before the script ran

you can do

player.CharacterAdded:Wait()

if not player.Character then player.CharacterAdded:Wait() end
1 Like

I got side tracked with something else, but it works, thanks!

1 Like

cattap

1 Like

Please mark your thread as solved

1 Like

Will do that from now on, thanks for the reminder.

2 Likes

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