For some reason in the script, it says Attempt to index nil with 'glow' I have tried using if statements to counter this but if statements don't work.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changer = ReplicatedStorage:WaitForChild("ColorChanger")
print("Remote event obtained")
workspace.DescendantAdded:Wait("Star")
changer.OnServerEvent:Connect(function(player)
local cloneStar = game.Workspace:FindFirstChild("Star")
print("Start")
local Colors = {BrickColor.new("Pastel yellow").Color, BrickColor.new("Cool yellow").Color, BrickColor.new("Daisy orange").Color, BrickColor.new("Bright yellow").Color, BrickColor.new("New Yeller").Color, BrickColor.new("Deep orange").Color}
local TweenService = game:GetService("TweenService")
local function ColorChange(ColorToChangeTo)
print("Function on")
local Union = cloneStar.glow
local tweenInfoColor = TweenInfo.new(1,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local ColorProperty = {}
ColorProperty.Color = ColorToChangeTo
local tween = TweenService:Create(Union,tweenInfoColor,ColorProperty)
tween:Play()
print("Tween playing")
wait(1)
end
while true do
for i,v in ipairs(Colors) do
ColorChange(v)
end
end
end)

5 comments
workspace.DescendantAdded:Wait("Star"). Doesn't work like that my man.
The :Wait method of RBXScriptSignal merely holds the thread until the Event fires, or the given* timeout is exceeded. You need to ensure your 'cloneStar' Instance exists before proceeding with it.
Oh, Imma delete it and also I tried that using an if statement and it didn't work for some reason
'if (cloneStar ~= nil) then'?
Yep, doesn't work for some reason, if you wanna see the code with the changes I can post it.