Hey developers
Please help with the script to save progress and checkpoints, otherwise I can’t figure it out in the scripts. I didn’t succeed, just write how, where to throw something and so on, otherwise I’ve written for 4 hours and I’m still waiting for your help.
Let’s go with something basic then.
If you want a leaderboard, you can start with adding a folder called “leaderstats” to Player in a PlayerAdded event.
Then you can create a NumberValue if you’ll set stages with numbers. Place it in leaderstats folder.
Then you can start storing the data. If you don’t know DataStores, there are really good tutorials on YouTube. Start with PlayerAdded, PlayerRemoving and game:BindToClose events. You can add a system which saves data when it changes, or just use DataStore2 (a module, similar to normal DataStores).
Please forgive me if I couldn’t help, I’m not a native English speaker so I might not understood the topic, but I still try to help as much as I can.
Now I don’t understand at all.
I reviewed everything on YouTube and not what I need.
Yes, something of this, let’s say you went up to stage 10, and you went out then went in again and you stayed at 10,
Although I can’t give your the whole script. I could help you to save the check point progress, since it may be a hard script to make for some.
- Insert a folder in Workspace, and name it Checkpoints NAME THE CHECKPOINTS WITH THE CORRESPONDING STAGE
- Put all the check points in the game under the Folder then
Add a script in the folder Checkpoints and put this code
for i,v in pairs(script.Parent:GetChildren()) do
v.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.Players[hit.Parent.Name].leaderstats.Value =
game.Players[hit.Parent.Name].leaderstats.Value + 1
end
end)
end
- Add a script in ServerScriptService
- Add this code in the script
local CheckPoints = workspace:FindFirstChild("Checkpoints"):GetChildren()
local dataStore = game:GetService("DataStoreService"):GetDataStore("Checkpoints") -- Change this to something unique
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local level = Instance.new("IntValue")
level.Name = "Level"
level.Parent = leaderstats
local playerCheckpoint
pcal(function()
playerCheckpoint = dataStore:GetAsync(player.UserId.."-Checkpoint")
end)
if playerCheckpoint ~= nil then
level.Value = playerCheckpoint
player.Character.HumanoidRootPart.CFrame = CheckPoints[playerCheckpoint].CFrame + Vector3.new(0,5,0)
else
level.Value = 1
player.Character.HumanoidRootPart.CFrame = CheckPoints["the name for the stage one check point"].CFrame + Vector3.new(0,5,0)
end
game.Players.PlayerRemoving:Connect(function(player)
dataStore:SetAsync(player.UserId.."-Checkpoint",player.leaderstats.Level.Value)
end)
It’s basically datastores.
Check the script I made, if it doesnt work, please send me the error in the Output window.
Okay, I’ll check it now. !!
And how to create checkpoints in dad? take spawn and set 1? or how?
ok so roblox created its own checkpoints. Insert the checkpoint from tool box, then customize it. And name it to the corresponding stage
Like
Stage 1 - Checkpoint’s name = 1
Did it work?
(30 CHARSSSSSSSSSSS)
Yup, working XD thank you. !
No problem
(30 CHARSS)