function userinterface()
game.StarterGui.ScreenGui.Frame.Transparency = 1
game.StarterGui.ScreenGui.Frame.Active = false
button.MouseButton1Click:Connect(userinterface())
while true do wait()
end
end
wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false
function teleport()
if not debounce then
debounce = true
LowerTorso = player.Character.LowerTorso
LowerTorso.CFrame = game.Workspace.CarSpawn.CFrame
end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
debounce = false
wait(1)
end
the function userinterface is supposed to make game.startergui.frame invisible and not active when the imagebutton is clicked
theres no error in the code or output it just doesnt work. plz help
inside the userinterface() function, which means it will not be bound until the function is first called. Meaning the function never gets called. Move this outside the function in order to bind the event.
local Player = game.Players.LocalPlayer
function userinterface()
Player.PlayerGui.ScreenGui.Frame.Visible = false
Player.PlayerGui.ScreenGui.Frame.Active = false
end
button.MouseButton1Click:Connect(userinterface())
wait(1)
button = script.Parent
local debounce = false
function teleport()
if not debounce then
debounce = true
HumanRoot = Player.Character.HumanoidRootPart
HumanRoot.CFrame = game.Workspace.CarSpawn.CFrame
end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
debounce = false
wait(1)
end
Tried cleaning it up the best I can, hope this helps