Great catch! If the script isn't teleporting you to the MazeStart part, it's likely because the script is using a fixed position (Vector3.new(50, 5, 50)) instead of referencing the actual MazeStart part in your Workspace. Let's fix that!
How to Teleport to the "MazeStart" Part
Make sure you have a part named "MazeStart" in your Workspace.
You can rename any part by selecting it and changing its Name property to MazeStart.
Update your script to reference the position of the "MazeStart" part.
Replace the fixed position with a reference to the part's position.
Here’s the improved script:
lua
-- Server Script: Attach this to your TeleportPortal part in the Workspace
local portal = script.Parent
local debounce = true
-- Reference the MazeStart part
local mazeStart = workspace:FindFirstChild("MazeStart")
if not mazeStart then
warn("MazeStart part not found in Workspace!")
return
end
portal.Touched:Connect(function(hit)
if debounce and hit and hit.Parent then
local character = hit.Parent
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.Health > 0 then
debounce = false
local rootPart = character:FindFirstChild("HumanoidRootPart")
if rootPart then
-- Teleport the player to the MazeStart part, slightly above it
rootPart.CFrame = mazeStart.CFrame + Vector3.new(0, 3, 0)
end
wait(1)
debounce = true
end
end
end)
Troubleshooting
If you see "MazeStart part not found in Workspace!" in the Output window:
Double-check that your MazeStart part is in the Workspace and spelled exactly as "MazeStart" (case-sensitive).
If you get stuck in the ground:
The + Vector3.new(0, 3, 0) lifts the player 3 studs above the MazeStart part. Adjust the number if needed.
Let me know if this works! If you want to add effects or sounds, just ask and I’ll show you how.