Issue with tutorial finish

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m making the end of my roblox studio tutorial, and it’s supposed to teleport the player at the end.

  2. What is the issue? Include screenshots / videos if possible!
    It’s just teleporting me to the start of the tutorial. The part it’s supposed to teleport me to isn’t a spawn location btw.

robloxapp-20250301-1151409.wmv (3.7 MB)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Yes, I have checked the dev forum and asked chat gpt why it could have happened (obviously chat gpt isn’t good at luau)

Here’s my script:

-- Wait for the LocalPlayer to be fully loaded
local player = game.Players.LocalPlayer
while not player do
	task.wait()
	player = game.Players.LocalPlayer
end

local PlayerGui = player:WaitForChild("PlayerGui")
local IntroGui = PlayerGui:WaitForChild("IntroGui")
local TweenServ = game:GetService("TweenService")
local event = workspace:WaitForChild("Tutorial"):WaitForChild("FinishPoint"):WaitForChild("Event")
local badgeServ = game:GetService("BadgeService")

event.OnClientEvent:Connect(function()
	workspace.Tutorial:WaitForChild("TutorialSpawn"):Destroy()
	-- Fade in the cover
	TweenServ:Create(IntroGui.Cover, TweenInfo.new(1), {BackgroundTransparency = 0}):Play()
	task.wait(1)
	IntroGui.Cover.Title.Visible = true
	task.wait(5)

	-- Fade out the cover
	TweenServ:Create(IntroGui.Cover, TweenInfo.new(1), {BackgroundTransparency = 1}):Play()
	IntroGui.Cover.Title.Visible = false

	-- Award the badge to the player
	badgeServ:AwardBadge(player.UserId, 1721480133389636)

	-- Get the spawn location's position
	local spawnLocation = workspace.Spawns:WaitForChild("StarterAreaSpawn")

	-- Teleport the player to the spawn location
	if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
		player.Character:SetPrimaryPartCFrame(spawnLocation.CFrame)
	end
end)

Are you using the same event to start and finsh the tutoral?

use printing on parts of the code, see if something is holding it from running.

there is only a finish event, no starting one.