The problem here is that whenever I have 1 or more rainbow things. It will mess up. For example: I have two different scripts constantly changing the color for a gui, but every now and then a Gui color will freeze. Is there anyway to fix this?
^^
Despite the scripts beings loaded at the same time. One will always freeze.
On top of that the scripts will freeze up other scripts. I have an intermission script and when intermission happens it will freeze on a number and then randomly continue. This happens despite all the rainbow scripts being in a separate place. I have no idea what to do to fix this.
local t = 5;
spawn(function()
while wait(0.1) do
local hue = tick() % t / t
local color = Color3.fromHSV(hue, 1, 1)
title.TextColor3 = color
end
end)
why would a totally separate script freeze up others?
I checked script performance and its using up less then 0.1%
The issue it could be is that you’re using spawn, which is known to be problamatic, I recommend converting it to a coroutine
local t = 5;
local rainbowloop = coroutine.wrap(function()
while wait(0.1) do
local hue = tick() % t / t
local color = Color3.fromHSV(hue, 1, 1)
title.TextColor3 = color
end
end
rainbowloop()
I found the problem, I had it so that whenever the textLabel was changed it redid the whole thing over again. So I had to add a debounce for whenever the colors were changing.
local title = script.Parent
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1, true, 0)
local inLoop = false
title.Changed:Connect(function()
if title.Text == "Tester" then
title.TextColor3 = Color3.fromRGB(75, 255, 10)
elseif title.Text == "Owner" and inLoop == false then
local t = 5;
local rainbowloop = coroutine.wrap(function()
while wait(0.01) do
local hue = tick() % t / t
local color = Color3.fromHSV(hue, 1, 1)
title.TextColor3 = color
end
end)
rainbowloop()
end
if title.Text == "Owner" then
inLoop = true
else
inLoop = false
end
end)
if there is a better solution to this let me know.