im trying to animate a selectionbox’s color to transition from red to black then black to red. i thought about changing the HSV’s value from 1 to 255 then 255 to 1 in a while loop but roblox simply cannot understand lua as it is not very bright and taking special ED classes in kindagarden. when my code simply works but roblox doesnt want to run it is what makes me mad.
local selection = Instance.new("SelectionBox")
selection.Adornee = script.Parent
selection.Parent = script.Parent
selection.LineThickness = 0.1
selection.Color3 = Color3.new(1, 0, 0.0156863)
while wait(0.1) do
wait(0.1)
for i=255,0,-1 do
wait(0.1)
local h,s,v = selection.Color3:ToHSV()
v = v - 1
local new = Color3.fromHSV(h,s,v)
selection.Color3 = new
end
wait(0.1)
for i=0,255,1 do
wait(0.1)
local h,s,v = selection.Color3:ToHSV()
v = v + 1
local new = Color3.fromHSV(h,s,v)
selection.Color3 = new
end
end
this was the code i tried yet roblox was unable to run the code as it didnt know what was going on and was confused. poor Roblox’s fragile brain!