I'm currently making a half life mod in Roblox and I'm trying to make it so that if you press a button in the main menu it teleports you to a select map. I already wrote a script for this but for some reason the code just wont execute and I don't get anything in output. The script is a local script and is a child of StarterGUI. Here is the code:
--\Buttons/
local btn1 = game.StarterGui.menu.main.gm_prompt.lbl_troom -- training room button
local main = game.StarterGui.menu.main
local maps = game.ReplicatedStorage.maps
local cmap = workspace.current_map
local char = game.Players.LocalPlayer.Character
local hroot = char:WaitForChild("HumanoidRootPart")
--
--Map Loader--
btn1.MouseButton1Click:Connect(function()-- executed on click of troom button
print("swear if it didn't work")
cmap.spwn_box:Destroy() -- Destroys spawn box
maps.c0p1.Parent = workspace.current_map
main.Visible = false
hroot.CFrame = maps.c0a1:WaitForChild("tp").CFrame
end)
Thanks in advance and sorry if its spaghetti I'm new and bad at coding

2 comments
Or do what he did instead.
Yeah this helped ty