My GUI's are not working correctly. Might be some of my scripts?
So what my scripts do is when they click the menu, it brings up a gui which shows them a gui which if they click it it will teleport them to a place and make the gui disappear. Here are the scripts below.
the problem is that when they join, for some reason it flashes the gui when i click it, what i mean by that is it shows and does not show and shows agian.
Another problem is that after they click the teliport button, if they click it agian, the menu gui does not show agian.
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
player.PlayerGui.menu.Frame.Visible = true
end)
This is where when they click the button, they show a gui.
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.SpawnLocation.CFrame
end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
debounce = false
wait(1)
if true then
script.Parent.Parent.Visible = false
end
end
this is the script where is they click another button, it teliports them somewhere
script.Parent.MouseButton1Click:Connect(function(click)
script.Parent.Parent:Destroy()
end)
this is where if they click the same button as the teliport, it will teliport them while also taking away the gui.
I am new to scripting, i can make easy types of scripts, so thats why it might look like a easy fix but not for me.