Hey, so I am trying to make this button only work when the background transparency is equal to 0, I am having some trouble with that though mainly because I am pretty bad at coding..
Here is the code I am trying to make work for this.
button = script.Parent if button.BackgroundTransparency = 0 then tele = game:GetService('TeleportService') button.MouseButton1Down:connect(function() local player = game.Players.LocalPlayer tele:Teleport(2561674732, player) end) end
Any help would be appreciated, sorry it's bad...
The reason this doesn't work at all is because it isn't setting the MouseButton1Click event at all.
button.MouseButton1Click:Connect(function() if (button.Transparency == 0) then --teleport stuff end end
The event is applied to where everytime it is clicked it will trigger and check the transparency. I wouldn't use transparency to check it. You should be using variables outside and changing accordingly. There also might be issues when comparing values. The transparencies might not be consistent. It may seem to be set to 0, but it can end up like 0.0000001 or some small difference that would make it not pass the if statement.