Teleport not working

My tp script isn’t working, why?

local clicked = false
local function BeginCollectingSequence()
	local startergui = game.Players.LocalPlayer.PlayerGui
	startergui.Shop.Enabled = false
local TeleportService = game:GetService("TeleportService")
local GameId = 5356825192
local object = script.Parent.Parent.Parent.Blackout
object.AnchorPoint = Vector2.new(0,0)
object.Position = UDim2.new(1, 0, 0, 0)
 object.Visible = true

script.Parent.MouseButton1Down:Connect(function()
	wait(1)
	BeginCollectingSequence()
		game.ReplicatedStorage.OtherSounds.Click:Play()
	object.BackgroundTransparency = 0
	object:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce)
wait(0.5)
TeleportService:Teleport(GameId)
end)

Help appreciated!

I’ll make your code look smoother if you don’t mind since it’s going to be easier for us to read your code. I’d also ask if you get any errors in the output and if you have tried to use breakpoints before?

local Clicked = false
local Player = game.Players.LocalPlayer
local TeleportService = game:GetService("TeleportService")
local GameId = 5356825192
local object = script.Parent.Parent.Parent.Blackout

object.AnchorPoint = Vector2.new(0,0)
object.Position = UDim2.new(1, 0, 0, 0)
object.Visible = true

local function BeginCollectingSequence()
	local StarterGui = Player.PlayerGui
	StarterGui.Shop.Enabled = false
end

script.Parent.MouseButton1Down:Connect(function()
	wait(1)
	BeginCollectingSequence()
	game.ReplicatedStorage.OtherSounds.Click:Play()
	object.BackgroundTransparency = 0
	object:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce)
    wait(0.5)
    TeleportService:Teleport(GameId)
end)

https://developer.roblox.com/en-us/api-reference/function/TeleportService/Teleport

So it is going from the game to one of its places.

what’s a breakpoint? (Sorry if its in this script it was re-done by my dev and I do not really know this type of stuff :slight_smile:

You can read more about breakpoints here.

So whats the issue with the script (I am checking rn if there are errors :slight_smile:)

It worked! Wonder what was wrong with that script though :thinking:

I just made your script clean but make sure that you have open the output window inside of a studio since it’s going to tell you what’s wrong with the scripts. Also, breakpoints are a nice thing to know how to use since you can look at what your script does step by step.

Why isn’t this other one working?

local Clicked = false
local Player = game.Players.LocalPlayer
local TeleportService = game:GetService("TeleportService")
local GameId = 5160406096
local object = script.Parent.Parent.Parent.Blackout.Frame

object.AnchorPoint = Vector2.new(0,0)
object.Position = UDim2.new(1, 0, 0, 0)
object.Visible = true



script.Parent.MouseButton1Down:Connect(function()

	game.ReplicatedStorage.OtherSounds.Click:Play()
	object.BackgroundTransparency = 0
	object:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce)
    wait(0.5)
    TeleportService:Teleport(GameId)
end)

You should provide more information on the problem, not just straight away say that your script isn’t working.

So technically, I duplicated the script and put it in another gui and now its not working.

More info on that: Since I moved it, maybe I misplaced the ‘object’. But I am 99% sure its correct.
The tp is going from place to game.