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

How would I make a spawn system, as seen in obbies? (Checkpoints)

Asked by 10 years ago

I'm having trouble making a obby spawn which means anytime you go to the next level, I want the player to hit the spawn then move on so when they die they dont go back to level 1, Example: Say i was on level 104, then I finally died then go back to level 1. If you don't understand, Here's more information Say, When I die on level 9, I don't(or players) don't wanna go back to level 1 with there hard work.

Thanks for advice :D

4 answers

Log in to vote
1
Answered by
Unclear 1776 Moderation Voter
10 years ago

As long as you have SpawnLocations with different TeamColors, Neutral disabled, and AllowTeamChangeOnTouch enabled, you can have your checkpoints. This will give you SpawnLocations that allows players sharing the same TeamColor as the SpawnLocation to spawn there.

Also make sure that each player's Neutral property is set to false to enable proper team changing!

If you're interested in players saving their level forever, you should look into Data Persistence and Data Store.

0
How'd I use that? Roboy5857 20 — 10y
0
DataStore Service Lightning_Game27 232 — 4y
Ad
Log in to vote
0
Answered by 10 years ago

It is a free model. Basically, when your player is created, the leaderstat is made and when you respawn, your CFrame of your Torso is moved to 2 units above the part that has the name the same as the leaderstat. There is a script in the parts (not SpawnLocations) that see if you completed that stage - 1 and if you did, your leaderstat is changed to that parts name. No script editing, but feel free to make your own.

Log in to vote
0
Answered by 4 years ago

A man walks into a bar

Log in to vote
0
Answered by 4 years ago

ROBLOX created a model for a checkpoint here's the script because you may get into some viruses in the toolbox

local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local checkpoint = script.Parent

function onTouched(hit)
    if hit and hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid") then
        local player = Players:GetPlayerFromCharacter(hit.Parent)
        local checkpointData = ServerStorage:FindFirstChild("CheckpointData")
        if not checkpointData then
            checkpointData = Instance.new("Folder")
            checkpointData.Name = "CheckpointData"
            checkpointData.Parent = ServerStorage
        end

        local userIdString = tostring(player.UserId)
        local checkpointValue = checkpointData:FindFirstChild(userIdString)
        if not checkpointValue then
            checkpointValue = Instance.new("ObjectValue")
            checkpointValue.Name = userIdString
            checkpointValue.Parent = checkpointData

            player.CharacterAdded:connect(function(character)
                wait()
                local storedCheckpoint = ServerStorage.CheckpointData[userIdString].Value
                character:MoveTo(storedCheckpoint.Position + Vector3.new(math.random(-4, 4), 4, math.random(-4, 4)))
            end)
        end

        checkpointValue.Value = checkpoint
    end
end

checkpoint.Touched:Connect(onTouched)

Answer this question