so i have this script which opens and closes both a teleporting and menu gui, IGNORE ALL THE OTHER STUFF PLS AND DONT CHANGE IT. what i want it to do is you can still click them to open but i also want it so if you click T it opens the teleport gui and M for the menu. this script is made by my friend and it all works so be carefull not to change all the other stuff
repeat wait() until game:IsLoaded()
local GUI = script.Parent
local Frame = GUI:WaitForChild("Frame")
local TeleportMenu = GUI:WaitForChild("TeleportMenu")
local ToggleMenu = GUI:WaitForChild("ToggleMenu")
local Remotes = game:GetService("ReplicatedStorage"):WaitForChild("Remotes")
local Remote = Remotes:WaitForChild("Teleport")
local ResetRemote = Remotes:WaitForChild("ResetData")
local SG = game:GetService("StarterGui")
local MenuShowing = false
local TeleportDebounce = tick()
local TeleportDebounceTime = 2
local TeleportShowing = false
local MusicButton = Frame:WaitForChild("Music")
local Teleport = Frame:WaitForChild("Teleport")
local Player = game:GetService("Players").LocalPlayer
local SecretRemote = Remotes:WaitForChild("SecretRemote")
local TextLayout = "%s/%s Secrets Found"
local SecretMaxCount = 13
local SecretCounter = Frame:WaitForChild("SecretCounter")
local ResetButton = Frame:WaitForChild("Reset")
local MsgBox = GUI:WaitForChild("MsgBox")
--local Music = Instance.new("Sound")
--Music.SoundId = "rbxasseti//288464336"
--Music.Volume = 0.7
--Music.Name = "Music"
--Music.Looped = true
--Music.Parent = workspace
--Music:Play()
Frame.Position = UDim2.new(0.5, 0, -0.179, 0)
GUI.Enabled = true
ResetButton.Activated:Connect(function()
local NewMsgBox = MsgBox:Clone()
NewMsgBox.Visible = true
NewMsgBox.Parent = GUI
local Confirm = NewMsgBox:FindFirstChild("Confirm")
local YesBox = NewMsgBox:FindFirstChild("Box")
local Close = NewMsgBox:FindFirstChild("Title"):FindFirstChild("Close")
if not Confirm or not YesBox or not Close then return end
Confirm.Activated:Connect(function()
if string.lower(YesBox.Text) == "yes" then
ResetRemote:FireServer()
NewMsgBox:Destroy()
end
end)
Close.Activated:Connect(function()
NewMsgBox:Destroy()
end)
end)
function UpdateCounter(Count)
if not Count then return end
SecretCounter.Text = string.format(TextLayout, Count, SecretMaxCount)
end
SecretRemote.OnClientInvoke = function(Action, Other)
if Action == "UpdateCounter" and Other.UpdatedCount then
UpdateCounter(Other.UpdatedCount)
end
end
UpdateCounter(SecretRemote:InvokeServer("GetCounter"))
Teleport.Activated:Connect(function()
TeleportShowing = not TeleportShowing
if TeleportShowing then
TeleportMenu:TweenPosition(UDim2.new(0.06, 0, 0.472, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
else TeleportMenu:TweenPosition(UDim2.new(-0.061, 0, 0.472, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
end
end)
ToggleMenu.Activated:Connect(function()
MenuShowing = not MenuShowing
if MenuShowing then
Frame:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
else Frame:TweenPosition(UDim2.new(0.5, 0, -0.179, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quart, 1, true)
end
end)
MusicButton.Activated:Connect(function()
local PS = Player:FindFirstChild("PlayerScripts")
if not PS then return end
local Music;
for i, v in pairs(PS:GetDescendants()) do
if v.Name == "BGM" then
Music = v
break
end
end
if Music then
if Music.Volume == 1 then
MusicButton.Text = "Music: Off"
Music.Volume = 0
else MusicButton.Text = "Music: On" Music.Volume = 1
end
end
end)
for i, v in pairs(TeleportMenu:GetChildren()) do
if v:IsA("TextButton") then
v.Activated:Connect(function()
local Character = Player.Character
if not Character then return end
local Humanoid = Character:FindFirstChild("Humanoid")
if not Humanoid then return end
if not ((tick() - TeleportDebounce) > TeleportDebounceTime) then
return
end
if Humanoid.Sit then
SG:SetCore("SendNotification", {Title = "Notification", Text = "Cannot teleport while seated.", Duration = 5, Button1 = "Ok"})
return
end
Remote:FireServer(v.Name)
TeleportDebounce = tick()
end)
end
end