|
| 24 Jul 2013 10:25 PM |
I need is so that if model.Name is in Players then leaves it will make model.Name = "Click to own.", Destroy LastOwner and Destroy game.Workspace.AllOwners.model.Name
model = script.Parent.Parent owners = game.Workspace.AllOwners while wait(0.5) do if game.Players:findFirstChild(model.Name) then print("player is in game") if owners:findFirstChild(model.Name) then print("FOUND!!!") end else print("player not here") owners:findFirstChild(model.Name):Destroy() wait() script.Parent.Parent.LastOwner:Destroy() model.Name = "Click to own." end end |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 24 Jul 2013 10:28 PM |
After the player has claimed the model, connect a Players.PlayerRemoving event to tell it to make it claimable instead of using that loop.
http://wiki.roblox.com/index.php/PlayerRemoving_(Event) |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2013 10:31 PM |
| I have been told that is not 100% reliable. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 24 Jul 2013 10:32 PM |
| It is 100% reliable; the event always fires. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2013 10:32 PM |
| It isn't reliable if you're using Data Persistence with it. |
|
|
| Report Abuse |
|
|
adark
|
  |
| Joined: 13 Jan 2008 |
| Total Posts: 6412 |
|
|
| 24 Jul 2013 10:33 PM |
| What's not 100% reliable is using Data Persistence as the Player can have removed fully before the data has had time to save. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 24 Jul 2013 10:34 PM |
| It's the Data Persistence that's not reliable. PlayerRemoving always works. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2013 10:43 PM |
Gotcha, thanks. Works like a charm now.
So what is the best way to auto save a users money or what ever with data persistence then? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2013 10:51 PM |
| Save it whenever it changes. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 24 Jul 2013 11:27 PM |
| @Iterations: Unfortunately, that doesn't save the data; it only APPEARS to save the data. The only real request to save the data is made when the player leaves. This is a problem. This is _the_ problem. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2013 11:32 PM |
| Ok so if the only way to save data is when a player leaves, whats up with these people having save buttons in there game? |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 24 Jul 2013 11:32 PM |
| So that they can write to the cached file which gets uploaded to the server at the end. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2013 11:41 PM |
| So If I made a game save when a user click the button, it would also have to have a script that saves once the user leaves the game? |
|
|
| Report Abuse |
|
|