|
| 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 |
|
|
| |
|
| |
|
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
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 5046 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 11 Aug 2014 04:56 PM |
| Theres a checkpoint intvalue inside the player (not inside leaderstats) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
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 |
|
|
| |
|
|
| 11 Aug 2014 05:12 PM |
| you forgot to put ".." somewhere but I fixed it |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|