ByDefault
|
  |
| Joined: 25 Jul 2014 |
| Total Posts: 3197 |
|
|
| 26 Dec 2015 04:23 AM |
I have this in a script
game.Players.PlayerRemoving:connect(function(player) if game:GetService("RunService"):IsStudio() == false then gameFuncs:Save(player) end end)
but it's not always saving? There's no errors and the :Save function works |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 04:23 AM |
game.OnClose = function() wait(10) end
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 04:24 AM |
And get rid of that "== false". Do this:
if not game:GetService("RunService"):IsStudio() then
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 26 Dec 2015 04:25 AM |
Gotta define the OnClose callback to keep the server from shutting down for X seconds so you can finalize things like data saving when everyone leaves a server.
http://wiki.roblox.com/index.php?title=API:Class/DataModel/OnClose |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 04:25 AM |
| Why would you advice that? "== false" is perfectly valid since IsStudio returns a boolean. |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 04:31 AM |
It's just another slightly better way.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 04:33 AM |
| Better? You mean it looks nicer in YOUR opinion? It's certainly not "better" |
|
|
| Report Abuse |
|
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 26 Dec 2015 04:33 AM |
That is a hand waving argument.
He asked you would you advise that? His question implies he wants reasoning for why it is better (SPOILER: It isn't). |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 04:38 AM |
Erm... A ROBLOX employee (can't remember who) said it was slightly more efficient - in a wiki article I can remember.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 04:42 AM |
Do you realize that "slightly" is less than slight, it's practically nothing. It's like comparing "pairs" vs "next", except probably less noticeable. |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 04:42 AM |
It still is a difference!
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 04:44 AM |
No. In scripting languages things like this don't count as difference. If you really want to go that far, then I will point out that every single piece of code you've ever written is inefficient, no matter what you think of it.
Don't even claim that it's a difference, because a difference like this is negligible compared to the 10000 other things you don't nitpick. |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 04:49 AM |
It's a matter of how much "nitpicking" knowledge you have in this environment really. My nitpicking may range up to easy -even if less than slight- differences.
This "difference" is something that takes a few seconds compared to other things like redesigning code.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 04:52 AM |
No, it's how you create arguments like this because it's not a real optimization. The OP shouldn't change "if x == false then" to "if not x then" unless he likes it better, it's not a matter of efficiency. |
|
|
| Report Abuse |
|
|
eqis
|
  |
| Joined: 31 Dec 2008 |
| Total Posts: 295 |
|
|
| 26 Dec 2015 04:55 AM |
| Not should be quicker because all it does is inverts the bool whereas a comparison involves subtraction. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 04:56 AM |
| It's "quicker" (in a very very small way, so small people shouldn't even say "use this instead of that") |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 05:00 AM |
But it is a matter of efficiency.
A difference which corresponds to one method having the same function/outlook but better performance to another method will always mean that the former will be more efficient than the latter - even if it is a small, minor, negligible or whatever you want difference.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 05:05 AM |
No, it's not. You don't understand the purpose of languages like Lua. 'same function/outlook' What does that even mean? For one, they both do different things, and for two it might not look more aesthetically pleasing to the OP.
It's not a matter of efficiency. |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 05:12 AM |
"Same function/outlook" means they basically do the same thing.
local Debounce = false
if not Debounce then wait(1) end if Debounce == false then wait(1) end
They have the same function.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 26 Dec 2015 05:15 AM |
@powerhot
we're not hand writing an asm program 30 years ago, we can afford to not write 100% efficient code.
any kind of benefit you gain from writing that will probably be immediately outweighed by your very next line |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 05:18 AM |
And if used the former than the next line would outweigh it even more.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 05:27 AM |
lmao you're so stupid, you act like you understand optimization when you don't. Stop being stubborn. I don't even want to get technical because you're locked in your fantasy world where no matter what I say, you're going to believe your own trash. |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2015 05:31 AM |
But what I'm saying is true. And what I'm saying is just saying that "not" is slightly better than == false. Which you've also admitted/stated.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Dec 2015 05:33 AM |
When I say better, I mean more efficient. It "looking nicer" is subjective, it "acting faster" is objective.
I never said that "== false" is the same speed, I said 3? times that it was technically slower. But the speed difference is nothing, you're probably one of those morons who say "use pairs instead of next, you save a SINGLE function call OMG!" |
|
|
| Report Abuse |
|
|