Hi guys I am trying to make a loop so that if the parent of the script transparency = 1 then the gui will be not visible but it doesn’t give any errors or work.
local background = script.Parent.BillboardGui.Background
local button = script.Parent
while true do
if button.Transparency == 1 then
background.Visible = false
else
background.Visible = true
end
wait(0.5)
end
LocalScripts can’t work if they’re parented inside the workspace, what exactly are you trying to do here? You could just reference it as a regular script & it should work fine
It is a tycoon and when someone buys the button the button turns transparency to 1 so I am trying to check when it turns to 1 so I can make my gui not visible
I still need the loop for something else tough why wouldn’t that work,
local player = game.Players.LocalPlayer
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
local price = script.Parent.Parent.Price
local background = script.Parent.BillboardGui.Background
local button = script.Parent
while true do
if Stats.Value >= price then
background.BackgroundColor3 = ('0, 255, 0')
else
background.BackgroundColor3 = ('255, 0, 0')
end
wait(0.5)
end
BackgroundColor3 is a Color3 value, not a string. Also you can’t access LocalPlayer from serverscripts.
(also i think your trying to check if a number is higher then a instance which isn’t possible)
(and you cant access serverstorage in localscripts i dont know what kind of script this is)
if Stats.Value >= price then
background.BackgroundColor3 = Color3.fromRGB(0, 255, 0)
else
background.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
end