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: Why is this not working?

Previous Thread :: Next Thread 
UnknownRichGuy is not online. UnknownRichGuy
Joined: 08 Jul 2013
Total Posts: 202
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 is not online. 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
UnknownRichGuy is not online. UnknownRichGuy
Joined: 08 Jul 2013
Total Posts: 202
24 Jul 2013 10:31 PM
I have been told that is not 100% reliable.
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
24 Jul 2013 10:32 PM
It is 100% reliable; the event always fires.
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
24 Jul 2013 10:32 PM
It isn't reliable if you're using Data Persistence with it.
Report Abuse
adark is not online. 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 is not online. 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
UnknownRichGuy is not online. UnknownRichGuy
Joined: 08 Jul 2013
Total Posts: 202
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
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
24 Jul 2013 10:51 PM
Save it whenever it changes.
Report Abuse
blocco is not online. 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
UnknownRichGuy is not online. UnknownRichGuy
Joined: 08 Jul 2013
Total Posts: 202
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 is not online. 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
UnknownRichGuy is not online. UnknownRichGuy
Joined: 08 Jul 2013
Total Posts: 202
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
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