Im trying to make a system where if I click a button some text labels and the button itself changes colors, it works fine when i click it once, but when i click it the second time it should change colors again but it doesn’t also the labels dont change the text or the color of the text, why is that?
code:
local plr = game.Players.LocalPlayer
local Spin1 = plr.PlayerGui.Shop.Spins.Frame.OneSpin
local Spin10 = plr.PlayerGui.Shop.Spins.Frame.SecondSpin
local Spin25 = plr.PlayerGui.Shop.Spins.Frame.ThirdSpin
if script.Parent.Text ~= "USE GOLD" then
script.Parent.MouseButton1Up:Connect(function()
if script.Parent.Text ~= "USE GOLD" then
script.Parent.Text = "USE GOLD"
script.Parent.BackgroundColor3 = Color3.new(1, 0.941176, 0.133333)
Spin1.TextButton.Text = "R$"
Spin10.TextButton.Text = "R$"
Spin25.TextButton.Text = "R$"
Spin1.TextButton.TextColor3 = Color3.new(0.32549, 1, 0.207843)
Spin10.TextButton.TextColor3 = Color3.new(0.32549, 1, 0.207843)
Spin25.TextButton.TextColor3 = Color3.new(0.32549, 1, 0.207843)
end
end)
end
if script.Parent.Text == "USE GOLD" then
script.Parent.MouseButton1Up:Connect(function()
script.Parent.Text = "USE R$"
script.Parent.BackgroundColor3 = Color3.new(0.32549, 1, 0.207843)
Spin1.TextButton.Text = "G"
Spin10.TextButton.Text = "G"
Spin25.TextButton.Text = "G"
Spin1.TextButton.TextColor3 = Color3.new(1, 0.941176, 0.133333)
Spin10.TextButton.TextColor3 = Color3.new(1, 0.941176, 0.133333)
Spin25.TextButton.TextColor3 = Color3.new(1, 0.941176, 0.133333)
end)
end
I ve tried using remote events but I get the same outcome, also I tried to use :Changed on the button and it shows that it changes onece but then the second click does do nothing