For context, this script is for a custom made slot machine made by me I recently revamped my source code to work with surfacegui and it seems that once the spin has ended aprox 5-10 seconds afterwards the colors start randomly changing when they arent supposed to....
Example of after spin... https://gyazo.com/b7f2ad17ce909a0044a43727841bdfc4
source code can be found below.
slot1 = script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot1 slot2 = script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot2 slot3 = script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot3 Colors = {Color3.fromRGB(0, 170, 127),Color3.fromRGB(0, 170, 255),Color3.fromRGB(255, 255, 127),Color3.fromRGB(255, 85, 255)} print(Colors[math.random(1,#Colors)]) amountpay = script.Parent.Parent.Require.Value amountwin = amountpay * 45 script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "Require: " .. amountpay .. " Reward: " .. amountwin function click(player) if player.leaderstats.Credits.Value >= amountpay then player.leaderstats.Credits.Value = player.leaderstats.Credits.Value - amountpay script.Parent.ClickSound:Play() for i = 1,10 do wait(.1) color = Colors[math.random(1,#Colors)] script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot1.BackgroundColor3 = color color = Colors[math.random(1,#Colors)] script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot2.BackgroundColor3 = color color = Colors[math.random(1,#Colors)] script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot3.BackgroundColor3 = color for i = 1,10 do wait(.1) color = Colors[math.random(1,#Colors)] script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot2.BackgroundColor3 = color color = Colors[math.random(1,#Colors)] script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot3.BackgroundColor3 = color for i = 1,10 do color = Colors[math.random(1,#Colors)] script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot3.BackgroundColor3 = color if slot1.BackgroundColor3 == {0, 170, 127} and slot2.BackgroundColor3 == {0, 170, 127} and slot3.BackgroundColor3 == {0, 170, 127} then script.Parent.JackpotSound:Play() script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = player.Name .. " Has Won " .. amountwin wait(6) script.Parent.JackpotExtraSound:Play() player.leaderstats.Credits.Value = player.leaderstats.Credits.Value + amountwin wait(3) script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "Require: " .. amountpay .. " Reward: " .. amountwin end if slot1.BackgroundColor3 == {0, 170, 255} and slot2.BackgroundColor3 == {0, 170, 255} and slot3.BackgroundColor3 == {0, 170, 255} then script.Parent.JackpotSound:Play() script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = player.Name .. " Has Won " .. amountwin wait(6) script.Parent.JackpotExtraSound:Play() player.leaderstats.Credits.Value = player.leaderstats.Credits.Value + amountwin wait(3) script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "Require: " .. amountpay .. " Reward: " .. amountwin end if slot1.BackgroundColor3 == {255, 255, 127} and slot2.BackgroundColor3 == {255, 255, 127} and slot3.BackgroundColor3 == {255, 255, 127} then script.Parent.JackpotSound:Play() script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = player.Name .. " Has Won " .. amountwin wait(6) script.Parent.JackpotExtraSound:Play() player.leaderstats.Credits.Value = player.leaderstats.Credits.Value + amountwin wait(3) if slot1.BackgroundColor3 == {255, 85, 255} and slot2.BackgroundColor3 == {255, 85, 255} and slot3.BackgroundColor3 == {255, 85, 255} then script.Parent.JackpotSound:Play() script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = player.Name .. " Has Won " .. amountwin wait(6) script.Parent.JackpotExtraSound:Play() player.leaderstats.Credits.Value = player.leaderstats.Credits.Value + amountwin wait(3) script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "Require: " .. amountpay .. " Reward: " .. amountwin else script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "You Have Lost" wait(1) script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "Require: " .. amountpay .. " Reward: " .. amountwin end else script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "Not enough credits" wait(3) script.Parent.Parent.gui.SurfaceGui.TextLabel.Text = "Require: " .. amountpay .. " Reward: " .. amountwin end end end end end end script.Parent.ClickDetector.MouseClick:connect(click)