Hello, Recently I decided to switch my slot machine over from brick to a surfacegui with some frames and what not, For some reason it is not listening to my script and does not change the 3 slot RGBs to any that are listed in the table, instead it makes them all 0,0,0 RGB.
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 * 50
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 = Color3.fromRGB(color)
color = Colors[math.random(1,#Colors)]
script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot2.BackgroundColor3 = Color3.fromRGB(color)
color = Colors[math.random(1,#Colors)]
script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot3.BackgroundColor3 = Color3.fromRGB(color)
end
for i = 1,10 do
wait(.1)
color = Colors[math.random(1,#Colors)]
script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot2.BackgroundColor3 = Color3.fromRGB(color)
color = Colors[math.random(1,#Colors)]
script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot3.BackgroundColor3 = Color3.fromRGB(color)
end
for i = 1,10 do
color = Colors[math.random(1,#Colors)]
script.Parent.Parent.ScreenBrick.SurfaceGui.MainFrame.SpinFrame.Slot3.BackgroundColor3 = Color3.fromRGB(color)
end
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
script.Parent.ClickDetector.MouseClick:connect(click)
If you could help point out what I did wrong here it would help me a lot.

2 comments
Within your click function, inside of the first loop, you are giving Color3.fromRGB a single Color3 value when instead it should be 3 numbers. No need to do such a thing three times inside of the for loop, just do it once.
@iiOmqLeetHyackth101 even without it being like that It wasent working, it was a suggestion from a user