crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 03 Apr 2012 02:01 PM |
Focus mainly on the leaving section, the players karts dont dissapear when they leave, im not too sure if this is with the :WaitForDataReady() in PlayerAdded. Help?
Game.Players.PlayerAdded:connect(function( Player ) Instance.new("BoolValue", Player).Name = "Roullete" Instance.new("BoolValue", Player).Name = "Racing" Instance.new("BrickColorValue", Player).Name = "Colour" Instance.new("NumberValue", Player).Name = "Kart" l = Instance.new("NumberValue", Player) l.Name = "Lap" Instance.new("NumberValue", Player).Name = "Section" Instance.new("NumberValue", Player).Name = "Position" Instance.new("IntValue", Player).Name = "leaderstats" Instance.new("IntValue", Player.leaderstats).Name = "VR" Instance.new("IntValue", Player.leaderstats).Name = "Coins" pwnage = 1000 if game.PlaceId ~= 0 then Player:WaitForDataReady() pwnage = Player:LoadNumber("Ranking") end if pwnage ~= 0 then Player.leaderstats.VR.Value = pwnage else Player.leaderstats.VR.Value = 1000 end Player.CharacterAdded:connect(function( Character ) Character.Humanoid.Died:connect(function() if Player.Racing.Value == true then if game.Workspace:findFirstChild("Karts") then if game.Workspace.Karts:findFirstChild(Player.Name) then game.Workspace.Karts[Player.Name]:Destroy() game.Workspace.Positions[Player.Name].Value = 100000 game.Workspace.Positions[Player.Name].Name = "NotUsed" end end Player.Racing.Value = false Player.leaderstats.VR.Value = Player.leaderstats.VR.Value - 2 if script.Parent.CurrentRacers.Value ~= 0 then script.Parent.CurrentRacers.Value = script.Parent.CurrentRacers.Value - 1 end end end) end) end)
game.Players.PlayerRemoving:connect(function(p) print(p.Name.." Is Leaving") if p.Racing.Value == true then print(p.Name.." Was Racing") if game.Workspace.Karts:findFirstChild(p.Name) then print(p.Name.." Had His Kart Removed") game.Workspace.Karts[p.Name]:Destroy() game.Workspace.Positions[p.Name].Value = 100000 game.Workspace.Positions[p.Name].Name = "NotUsed" end if script.Parent.CurrentRacers.Value ~= 0 then script.Parent.CurrentRacers.Value = script.Parent.CurrentRacers.Value - 1 end elseif game.Workspace.Practice:findFirstChild(p.Name) then game.Workspace.Practice[p.Name]:Destroy() end if p.DataReady == true then p:SaveNumber("Ranking", p.leaderstats.VR.Value) end end) |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2012 02:21 PM |
| You can't save data once the player has left. |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 03 Apr 2012 02:28 PM |
| Prehistoric, the thing is, it DOES do that. maybe it saves then breaks after? |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
| |
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
| |
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
| |
|
|
| 03 Apr 2012 06:57 PM |
@Prehistoric
I read somewhere that you only need a reference of the player, though I can't verify this. |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 03 Apr 2012 07:06 PM |
Okay, after witnessing gameplay, heres what i can piece up:
Players joining still get all the stuff and data loaded: PlayerAdded = A.Ok.
Players Leaving On the other hand, DO have their data saved, but have some wierd problems with the karts staying even though its all valid compared to the 'if' statements.
|
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 03 Apr 2012 07:23 PM |
| Bump, im in need of some serious help here. I understand many dont know the answer but i'd appreciate it if people who did know the answer would post. |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
| |
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 04 Apr 2012 11:06 AM |
| Would it be better if i put the data persistance code in another script? |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
| |
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
| |
|
|
| 04 Apr 2012 11:39 AM |
'if game.Workspace.Karts:findFirstChild(p.Name) then'
Does this mean the kart has the name of the player?
If so, can't you place something like:
while true do if game.Players:findFirstChild(script.Parent.Name) == nil then script.Parent:remove() end wait() end
Put this in the karts |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 04 Apr 2012 11:59 AM |
| That would work, but at mass it would be inefficient, plus it wouldnt solve the other problems like races not finishing when there are no racers left. |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2012 12:02 PM |
| What exactly of the playerleave doesn't work? |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 04 Apr 2012 12:03 PM |
| That i cant explain as i cant retreive output from roblox servers. |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 04 Apr 2012 12:06 PM |
Radio, im re-posting a previous post of what i know.
Players joining still get all the stuff and data loaded: PlayerAdded = A.Ok.
Players Leaving On the other hand, DO have their data saved, but have some wierd problems with the karts staying even though its all valid compared to the 'if' statements. |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2012 12:08 PM |
what if you ran it in a local server (studio) without the save data thingie.
What output do you get there? |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 04 Apr 2012 12:12 PM |
With a local server it cant use more than 1 player because A: Confusion with kart and player names B: Only got 2gb memory
i honestly think the problem is related to the data saving. |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2012 12:26 PM |
Tested it without the save thingie.
It works, so it's indeed something about save data.
A friend of mine has a working leaving save thingie, I will look what's written in there... |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2012 12:55 PM |
Hmm, it's just a normal SaveNumber method...
Guess these are those moments where you have to blame the Roblox program... |
|
|
| Report Abuse |
|
|
crazyblox
|
  |
| Joined: 16 Mar 2008 |
| Total Posts: 6139 |
|
|
| 05 Apr 2012 09:13 AM |
| So i guess ill just put the load and save in a script of its own so it wont interfere? |
|
|
| Report Abuse |
|
|
| |
|
breuning
|
  |
| Joined: 30 Oct 2008 |
| Total Posts: 4268 |
|
|
| 05 Apr 2012 10:21 AM |
| Blame John... and the ImPlicitNgine. |
|
|
| Report Abuse |
|
|