generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Saveable Checkpoints

Previous Thread :: Next Thread 
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 04:31 PM
I tried to make saveable checkpoints without help, the checkpoints are called "Worlds". There is no error, I checked the output (weird). How do I make checkpoints that save when you leave the game. When they enter the game again, they teleport to that checkpoint.
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 04:35 PM
b1
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 04:36 PM
b2
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
11 Aug 2014 04:37 PM
Use data stores to save their point as a value. Ex: 1 = first check point 10 = 10th check point and so on.
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
11 Aug 2014 04:37 PM
Data Stores
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 04:38 PM
I don't know how to use data stores lol. I tried it before and my leaderboard didn't work.
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
11 Aug 2014 04:39 PM
Is there an invisible brick or something at each check point?
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
11 Aug 2014 04:40 PM
Well the only way to save checkpoints is to use Data Stores or Data Persistence and it is HIGHLY recommended not to use data persistence.
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 04:41 PM
yea use data persistence I need to learn data stores and yes the checkpoints are invisible
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
11 Aug 2014 04:46 PM
Im missing too much information to make the script for you, I need the following:

1) Where you store their check point
2) How many checkpoints in total
3) anything you think might help.
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 04:53 PM
1) I store the checkpoints (or "worlds") under the WorldsKey
2) 30 checkpoints
3) They go to a invisible SpawnLocation then they teleport to the checkpoint
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
11 Aug 2014 04:54 PM
1) I store the checkpoints (or "worlds") under the WorldsKey

What do you mean? As a IntValue or something? Is this inside the player? Hierarchy pls.
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 04:56 PM
Theres a checkpoint intvalue inside the player (not inside leaderstats)
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 05:00 PM
bump
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 05:03 PM
bump2
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
11 Aug 2014 05:07 PM
try this (Data stores only work in server scripts):

Data = game:GetService("DataStoreService"):GetDataStore("CheckP")

game.Players.PlayerRemoving:connect(function(rp)
Data:SetAsync("Player_"..rp.userId, rp.WorldsKey.Value)
print("Saved Data for "..rp.userId.." checkpoint: "..rp.WorldsKey.Value)
end)

game.Players.PlayerAdded:connect(function(p)
if Data:GetAsync("Player_"..p.userId) then
print("Data Found!")
wait(3) --give 3 seconds to load data
p.WorldsKey.Value = Data:GetAsync("Player_"..p.userId)
print("Set checkpoint for: "..p.userId.." as: "..Data:GetAsync("Player_"p.userId))
else
p.WorldsKey.Value = 0
end
end)
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 05:11 PM
I see a red line
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 05:12 PM
you forgot to put ".." somewhere but I fixed it
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
11 Aug 2014 05:14 PM
-- you have to update the stat "Checkpoint" yourself.

points = {[1] = game.Workspace.Point1,
[2] = game.Workspace.Point2,
[3] = game.Workspace.Point3};
UTIL = assert(LoadLibrary("RbxUtility"));
EXEC = UTIL.Create;

ds = game:GetService("DataStoreService"):GetDataStore("WorldCheckpoints");

game.Players.PlayerAdded:connect(function(plr)
wait();
if(ds:GetAsync(tostring(plr.userId).."Checkpoints") == nil) then
ds:SetAsync(tostring(plr.userId).."Checkpoints", 1);
end
local folder = EXEC'Model'{Name = "leaderstats"; Parent = plr;};
local new = EXEC'NumberValue'{Parent = folder; Value = ds:GetAsync(tostring(plr.userId).."Checkpoints"); Name = "Checkpoint";};
plr.Character:MoveTo(points[new.Value].Position, points[new.Value]);
end)

game.Players.PlayerRemoving:connect(function(plr)
ds:SetAsync(tostring(plr.userId).."Checkpoints", plr.leaderstats.Checkpoint.Value);
end)
Report Abuse
awesomeplayer7000 is not online. awesomeplayer7000
Joined: 09 Apr 2014
Total Posts: 1112
11 Aug 2014 05:57 PM
@ali and how do I make the player teleport to the checkpoint?
checkpoints are In workspace
the checkpoints are named in just numbers "1","2" til 30
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
11 Aug 2014 06:03 PM
Data = game:GetService("DataStoreService"):GetDataStore("CheckP")

game.Players.PlayerRemoving:connect(function(rp)
Data:SetAsync("Player_"..rp.userId, rp.WorldsKey.Value)
print("Saved Data for "..rp.userId.." checkpoint: "..rp.WorldsKey.Value)
end)

game.Players.PlayerAdded:connect(function(p)
if Data:GetAsync("Player_"..p.userId) then
print("Data Found!")
wait(3) --give 3 seconds to load data
p.WorldsKey.Value = Data:GetAsync("Player_"..p.userId)
print("Set checkpoint for: "..p.userId.." as: "..Data:GetAsync("Player_"..p.userId))
else
p.WorldsKey.Value = 0
end
for i,v in pairs(game.Workspace:GetChildren()) do
if v.Name == p.WorldsKey.Value then
p.Character:MoveTo(v.Position+Vector3.new(0,5,0))
end
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image