So I am making an obby and I made stages and the stages work but when I get to the stage 2 spawn, I sometimes spawn back at stage 1. How do you make it so when you get to stage 2 and so on that you spawn there?
How do you make someone spawn at a different location without teams?
2 answers
Ok, so make a part to step on to make your spawn there on stepped. Use this script in your spawn part. Also, just put ONE spawn location at start. Hope you enjoy!
local spawn = script.Parent
spawn.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
if not checkpointData then
checkpointData = Instance.new("Model", game.ServerStorage)
checkpointData.Name = "CheckpointData"
end
local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
if not checkpoint then
checkpoint = Instance.new("ObjectValue", checkpointData)
checkpoint.Name = tostring(player.userId)
player.CharacterAdded:connect(function(character)
wait()
character:WaitForChild("Torso").CFrame = game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
end)
end
checkpoint.Value = spawn
end
end)
function oa(object) local player = game.Players:playerFromCharacter(object) if player ~= nil then local ls = player.leaderstats local sl = game.Workspace:FindFirstChild(ls.Stage.Value) object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0) wait() object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0) end end
function oe(object) if object.className == "Player" then local ack = Instance.new("IntValue") ack.Name = "leaderstats" local ack2 = Instance.new("IntValue") ack2.Name = "Stage" ack2.Value = 1 ack2.Parent = ack ack.Parent = object end end
game.Players.ChildAdded:connect(oe) game.Workspace.ChildAdded:connect(oa)
(Try this.)
6 comments
That makes no sense, I need a full explanation.
In this, functions are over viewing changing the Stage.Value, and where the CFrame of the "Humanoid", or character, spawns.
This site hates code without explanation.
I have seen that,
Ikr, this does not makes sense. Lol
Try fiddling around with some properties on the spawn.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Important: JUST put ONE spawn location AT your desired first stage. And insert this script into a PART.