Data save checkpoints | Roblox studio TUTORIAL

Channel:
Subscribers:
3,680
Published on ● Video Link: https://www.youtube.com/watch?v=5ypGzUpxl4w



Roblox
Game:
Roblox (2006)
Category:
Tutorial
Duration: 3:16
269 views
10


Thanks for watching!

YOU WILL NEED TO CHANGE SOMETHING IN THE SCRIPT "moveStage" BEACUSE YOUTUBE ISN'T LETTING ME TO PUT THE ANGLED BRACKET in the description

Codes:
CheckpointSave
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local SaveDataStore = DataStoreService:GetDataStore("SaveData")


local function SavePlayerData(player)

local success,errormsg = pcall(function()

local SaveData = {}

for i,stats in pairs(player.leaderstats:GetChildren()) do

SaveData[stats.Name] = stats.Value
end
SaveDataStore:SetAsync(player.UserId,SaveData)
end)

if not success then
return errormsg
end
end


Players.PlayerAdded:Connect(function(player)

local Stats = Instance.new("Folder")
Stats.Name = "leaderstats"
Stats.Parent = player

local Stage = Instance.new("StringValue")
Stage.Name = "Stage"
Stage.Parent = Stats
Stage.Value = 1

local Data = SaveDataStore:GetAsync(player.UserId)

if Data then

print(Data.Stage)

for i,stats in pairs(Stats:GetChildren()) do

stats.Value = Data[stats.Name]
end
else
print(player.Name .. " has no data.")
end


player.CharacterAdded:Connect(function(character)

local Humanoid = character:WaitForChild("Humanoid")
local Torso = character:WaitForChild("HumanoidRootPart")

wait()

if Torso and Humanoid then
if Stage.Value ~= 0 then

local StagePart = workspace.Stages:FindFirstChild(Stage.Value)
Torso.CFrame = StagePart.CFrame + Vector3.new(0,1,0)
end
end
end)
end)


Players.PlayerRemoving:Connect(function(player)

local errormsg = SavePlayerData(player)

if errormsg then
warn(errormsg)
end
end)

game:BindToClose(function()
for i,player in pairs(Players:GetPlayers()) do

local errormsg = SavePlayerData(player)
if errormsg then
warn(errormsg)
end
end
wait(2)
end)
--------------------------------------------------------------------------------------
moveStage
local Stages = workspace:WaitForChild("Stages")

for i,Stage in pairs(Stages:GetChildren()) do

Stage.Touched:Connect(function(touch)

local humanoid

if touch.Parent:FindFirstChild("Humanoid") then

humanoid = touch.Parent.Humanoid
end

if touch.Parent and touch.Parent.Parent:FindFirstChild("Humanoid") then

humanoid = touch.Parent.Parent.Humanoid
end

if humanoid then

local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)

local PlayerStage = player.leaderstats.Stage.Value

if tonumber(Stage.Name) == PlayerStage + 1 then

player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1

elseif tonumber(Stage.Name) is higher PlayerStage + 1 then -- change the "is higher" for the angled bracket is higher

humanoid.Health = 0
end
end
end
end)

-----------------------------------------------------------------------------------

Twitch: https://www.twitch.tv/the_lovjak
Twitter 🐦: https://twitter.com/ThE_LovJak
Discord: https://discord.gg/bcCFBdZ8dm

Subscribe to JakLov: https://www.youtube.com/channel/UCZYHTvHRCqAvNAaiBJZw0Rg



how to make so when a player touches a checkpoint, leaves and joins back and he will be at that checkpoint
#roblox #tutorial




Other Videos By LovJak


2023-07-03sub if messi is the GOAT🐐 #football #footballgame #trending #short #shortvideo #shorts #messi
2023-07-03Oh hell nah💀 #football #footballgame #short #shortvideo #shorts
2023-07-02Who will win the ballon d'or? Haaland or Messi | #ballondor #football #messifootball #messi #haaland
2023-07-01The Ultimate 2v2 Showdown: Rocket League Tournament Revealed
2023-06-30What a lovely strike! (volley)
2023-06-29The net is staring him😂🤣 | #fifa
2023-06-29speed quit youtube... 😪 | #ishowspeed #speed #america #usa #youtube #youtubeshorts #joebiden #biden
2023-06-29Expected transfer vs reality | #football #transfer #summer #messi #barcelona #miami
2023-06-28i, don't like.. (football edition) | #football #footballgame #messi #ronaldo #camavinga #shortvideo
2023-06-28i, don't like.. (soccer edition) | #soccer #soccer #messi #ronaldo #camavinga #bellingham #joebiden
2023-06-28Data save checkpoints | Roblox studio TUTORIAL
2023-06-27How about that for a chip? | in #fifa
2023-06-26What IS THAT?😂
2023-06-25🤯 #neymar jr. from #ohio 💀 | #football #footballgame #footballshorts #shortvideo #shorts #short
2023-06-25INSANEEEE GOALS IN FIFA 23 🤯🤯
2023-06-25Insane goals scored in #fifa23 | #fifa #football #footballgame #footbalshorts #ps4 #ps5
2023-06-24Rocket League Competitive 2v2 ft. JakLov (SEASON 11) | #rocketleague
2023-06-22The Mind-Blowing Evolution of Humanity's Information Access | #elonmusk #interview
2023-06-22Attention facts | #facts #attention #shortvideo #shorts #short
2023-06-19#marvel or #dc who is better? | #shorts #subscribe #doall #trendingshorts #trending
2023-06-15Your #month your #footballplayer #part1 #football #soccer #rarekicks #edit #messi #haaland



Tags:
roblox
roblox studio
tutorial
roblox tutorial
studio
how to



Other Statistics

Roblox Statistics For LovJak

Currently, LovJak has 127,722 views for Roblox across 80 videos. His channel uploaded 9 hours worth of Roblox videos, or 26.34% of the total watchable video on LovJak's YouTube channel.