I am making a list of GUI appear depending on a value in the player, however these GUI only appear unless I add wait(whatever number), however I don't want to go about this way due to people loading in at different speeds. Is there a better way to go about this?



local Players = game:GetService("Players")
local player = Players.LocalPlayer

local Colors = script.Parent
local race = player:WaitForChild("playerInfo"):WaitForChild("Race")


if race.Value == "Human" or race.Value == "Mechanian" then
	Colors.Color1.Visible = true
	Colors.Color2.Visible = true
	Colors.Color3.Visible = true
end

if race.Value == "Vespian" then
	Colors.Color4.Visible = true
	Colors.Color5.Visible = true
	Colors.Color6.Visible = true
end

if race.Value == "Celestial" then
	Colors.Color7.Visible = true
	Colors.Color8.Visible = true
	Colors.Color9.Visible = true
end

if race.Value == "Hollowed" then
	Colors.Color10.Visible = true
	Colors.Color11.Visible =  true
	Colors.Color12.Visible = true
end

if race.Value == "Outworlder" then
	Colors.Color13.Visible = true
	Colors.Color14.Visible = true
	Colors.Color15.Visible = true
end

if race.Value == "Mystic" then
	Colors.Color16.Visible = true
	Colors.Color17.Visible = true
	Colors.Color18.Visible = true
end

2 comments

0

Just repeat wait() until race.Value ~= nil. I imagine that's what you want.

0

That works, thank you!