Help with TP script

I am making a script where when you click it, it should tp you to another game. Thats covered but my function is not working. I made a function supposed to make all the GUI’s invisible, but its not working. Why?

local clicked = false
local function BeginCollectingSequence()
	local startergui = game.StarterGui
	startergui.Shop.Enabled = false
	startergui.TPMenu.Close.Visible = false
	startergui.TPMenu.Open.Visible = false
	startergui.TPMenu.MenuFrame.Visible = false
	startergui.Tutorial.Enabled = false
	end
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()
	object.BackgroundTransparency = 0
	object:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce)
wait(0.5)
TeleportService:Teleport(GameId)
end)

All help appreciated

1 Like

But my question is why is it not getting rid of the GUI’s? The tp is fine

Yes, you do need to specify the player too

But my question is why isnt the function working? Everything is fine…

I think you need to change the visible in game.Players.PlayerGui

So change local startergui = game.Players.PlayerGui

1 Like

I did some stuff and it worked, YAY

1 Like