I am trying to make a tycoon and this script to make a button appear when another button disappears. This is my script.
local button = script.Parent
local otherbutton = workspace.DoorWallMaker.Spawner.Transparency
button.Transparency = 1
wait(1)
while true do
if otherbutton == 1 then
print("e")
button.Transparency = 0
wait(0.05)
else
print("no")
wait(0.05)
end
end
This seems like it should work. Why is it not working?
@JollyGameCrazy is right. Also, I recommend you create a function and store your information in that instead. Then call it every time other button’s properties change using otherbutton.Changed. This is more reliable than a while loop.
Hmm, strange. However, maybe its because the other button isn’t at 1 to begin with. When you start the game, nothing is changing the otherbutton’s value. try @Fledgeon’s method and do this
otherbutton.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
otherbutton.Transparency = 1
end
-- keep the while true do script but put the function before the while true do
end)