So am trying to make a script that when you trigger proximity prompt it teleports you to a part but it doesnt teleport me so can anyone help me fix it?
-- get the part in the workspace to teleport the player to
local teleportPart = workspace.TeleportPart
-- function to handle proximity prompt triggered events
local function onPromptTriggered(prompt, player)
-- get the player's leaderstats
local leaderstats = player:FindFirstChild("leaderstats")
-- check if the player's level is equal to 1
if leaderstats and leaderstats.Level.Value == 1 then
-- teleport the player to the teleportPart
player.Character:SetPrimaryPartCFrame(teleportPart.CFrame)
end
end
-- find the proximity prompt in the workspace
local prompt = workspace:FindFirstChild("ProximityTeleport")
-- connect the prompt triggered event to the onPromptTriggered function
prompt.Triggered:Connect(onPromptTriggered)
** You are now Level 3! **
