How to Make a Obby Checkpoint System With Data Store in Roblox Studio!

Опубликовано: 06 Февраль 2023
на канале: Netherite STUDIOS
8,771
209

In todays video, I will teach you how to make an obby checkpoint system that saves in roblox studio!
-------------------------------------------------------------------------------------------------
✨Current Subscribers✨ - 🍀1454🍀
💎Subscribe Here💎 - https://www.youtube.com/c/NetheriteST...
👑Become a Member!👑 -    / @netheritestudios  

GnomeCode's channel: ‪@GnomeCode‬
GnomeCodes EPIC data store vid:    • Save Player Data with Roblox Datastores  

Script:
local SpawnsFold = game.Workspace:WaitForChild("ObbyCheckpoints")
local defaultSpawn = SpawnsFold:WaitForChild("1")

local DS = game:GetService("DataStoreService"):GetDataStore("SaveCheckpoint")
local sessionData = {}

game.Players.PlayerAdded:Connect(function(plr)
plr.RespawnLocation = defaultSpawn

local leaderstats = Instance.new("Folder", plr)
leaderstats.Name = "leaderstats"

local Level = Instance.new("IntValue", leaderstats)
Level.Name = "Level"

local success = nil
local playerData = nil
local attempt = 1

repeat
success, playerData = pcall(function()
return DS:GetAsync(plr.UserId, sessionData[plr.UserId])
end)

attempt += 1
if not success then
warn(playerData)
task.wait(3)
end
until success or attempt == 5

if success then
if not playerData then
playerData = {
["Level"] = 1
}
end
sessionData[plr.UserId] = playerData
else
plr:Kick("Unable to load saved data for "..plr.Name.." Try again soon!")
end

Level.Value = sessionData[plr.UserId].Level
plr.RespawnLocation = SpawnsFold:FindFirstChild(Level.Value)
plr:LoadCharacter()

Level.Changed:Connect(function()
sessionData[plr.UserId].Level = Level.Value
end)
end)

function playerLeaving(plr)
if sessionData[plr.UserId] then
local success = nil
local errorMsg = nil
local attempt = 1

repeat
success, errorMsg = pcall(function()
DS:SetAsync(plr.UserId, sessionData[plr.UserId])
end)

attempt += 1
if not success then
warn(errorMsg)
task.wait(3)
end

until success or attempt == 5

if success then
print("Data saved for "..plr.UserId)
else
warn("Unable to save for "..plr.Name)
end
end
end

game.Players.PlayerRemoving:Connect(playerLeaving, game.Players.PlayerRemoving)

local RunService = game:GetService("RunService")

function serverShutdown()
if RunService :IsStudio() then
return
end

for i, plr in ipairs(game.Players:GetChildren()) do
task.spawn(function()
playerLeaving(plr)
end)
end
end

---------Time Stamps--------
▶ (0:00) Intro
▶ (0:18) Setup
▶ (1:05) Leaderstats
▶ (3:02) Checkpoint Int Values
▶ (3:47) Checkpoint Changer
▶ (6:32) Showcasing Checkpoint Changer
▶ (7:12) Data Store Time-lapse
▶ (9:18) Enable API Services
▶ (9:58) Data Store Bug Fix
▶ (10:09) Outro/Showcase
--------------Friends-------------
Gurrbrew:
▶    / @gurrbrew  

Pigeon:
▶    / @pigeonflysdrones3203  
----------Social Media--------
Roblox Gaming Channel:
▶    / @netheritedevv  

Group:
▶ https://web.roblox.com/groups/7546926...

Roblox Merch:
▶ https://web.roblox.com/groups/7546926...

Discord:
▶   / discord  

Twitter:
▶   / netheritestudlo  

Other Channel:
▶    / @sculkyyold  

Roblox Profile:
▶ https://web.roblox.com/users/63566575...
-------------------------------------------------------------------------------------------------
If you need help with this tutorial, make sure to join the discord and create a ticket!
-------------------------------------------------------------------------------------------------

---------Music License:---------

That Good Feeling:

Music from #Uppbeat (free for Creators!):
https://uppbeat.io/t/atm/that-good-fe...
License code: QPHMFVGVWYMICOIS


Смотрите видео How to Make a Obby Checkpoint System With Data Store in Roblox Studio! онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Netherite STUDIOS 06 Февраль 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 8,771 раз и оно понравилось 209 людям.