Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make your character spawn where they are supposed to??

Asked by 6 years ago

I'm making an obby so I put a few spawn points for checkpoints. but everytime I die it just sends me to a random checkpoint and not the one right before I died, how do I fix this?

0
Lol who upvoted this DinozCreates 1070 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

Make sure neutral is disaled and AllowTeamChangeOnTouch is enabled. Also try making a different team color for each checkpoint.

Ad
Log in to vote
0
Answered by
fr2013 88
6 years ago
Edited 6 years ago

Insert a normal Script in each of the parts and add the code to make the player return where they left off after they died.

01local spawn = script.Parent -- Find where the part is
02spawn.Touched:connect(function(hit) -- When the player touches the part
03    if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then -- If the player who touches the part is a humanoid
04        local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Find any players
05        local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData") -- Creates some sort of Data Store
06        if not checkpointData then
07            checkpointData = Instance.new("Model", game.ServerStorage)
08            checkpointData.Name = "CheckpointData"
09        end
10 
11        local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
12        if not checkpoint then
13            checkpoint = Instance.new("ObjectValue", checkpointData)
14            checkpoint.Name = tostring(player.userId)
15 
View all 24 lines...
0
nice joke ya got there User#23365 30 — 6y
0
Doesn't seem invalid to me fr2013 88 — 6y

Answer this question