I created a script that teleports a player back to the start place when they die. For some reason it keeps sending them back to a new server of the place they were already in rather than sending them to the start place. I am 100000% sure I used the right ID.
local plr = game:GetService("Players").LocalPlayer
local char = script.Parent
local id = 2306562216
local TeleportService = game:GetService("TeleportService")
char:WaitForChild("Humanoid").Died:Connect(function()
wait(1)
TeleportService:Teleport(id, plr)
end)
I fixed up your script @SamsonXVI and it worked for myself, please send feedback if it worked or if it didn’t work. You also did use the correct ID as I tested and it teleported me to the place with the name Camping.
Script:
local char = script.Parent
local id = 2306562216
local TeleportService = game:GetService("TeleportService")
local TeleportDebounce = false
while wait() do -- Loops the script to check if the player died all the time instead of when the player joins
if not TeleportDebounce then -- Check is the debounce is set to false
TeleportDebounce = true -- Sets the debounce to true
char:WaitForChild("Humanoid").Died:Connect(function() -- Waits for the player to die
TeleportService:Teleport(id, game.Players.LocalPlayer) -- More direct way of getting the local player
end)
else
if TeleportDebounce then -- Checks if the debounce is true and if it is then it does nohing
-- Makes the function do nothing since it will loop if a debounce is not set
end
end
end
Why do you have an else statement when it does nothing? You can just remove everything from the else until the second end, can’t you?
Edit: After testing, @SamsonXVI, your script worked fine for me. I think you’re using the wrong ID, since “Camping” is the place you start in by default (that’s why “Mark as Start Place” is grayed out) and you probably meant to teleport the player to Campgrounds.
Edit 2: After re-reading the original post, it looks like this script is in the Camping place, and you’re trying to teleport from Campgrounds to Camping? You need to have the script be in Campgrounds for it to teleport from there.
You’re going to laugh at this… I’ve been using “Save” instead of Publish to roblox since Roblox changed the default popup when you close the tab in studio. Thanks for all the help though!!! I got it working now.