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: Script crashes the game

Previous Thread :: Next Thread 
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Sep 2011 08:44 PM
[ Content Deleted ]
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
14 Sep 2011 08:47 PM
stats = {"Money","num","wait"}

game.Players.PlayerAdded:connect(function(p)
coroutine.resume(coroutine.create(function()
for i = 1, #stats do
local a = Instance.new("IntValue",p)
a.Name = stats[i]
end
if p:FindFirstChild("num") then
p.num.Value = 10
end
if p:FindFirstChild("wait") then
p.wait.Value = 5
end
local b = Instance.new("BoolValue",p)
b.Value = false
b.Name = "Owned"
while true do -- Probably around here. That's a loop occuring 30 times per second PER PLAYER. There must be a better way to do that.
wait()
if game.Players:FindFirstChild(p.Name)then
wait(p.Wait.Value)
p.cash.Value = p.cash.Value + p.num.Value
end
end
end))
end)
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Sep 2011 08:50 PM
[ Content Deleted ]
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
14 Sep 2011 08:51 PM
Because wait() waits a frame, around .03 seconds, so 1 / .03 = around 30.
Report Abuse
Lowcart is not online. Lowcart
Joined: 12 Sep 2011
Total Posts: 1323
14 Sep 2011 09:03 PM
[ Content Deleted ]
Report Abuse
nPwn is not online. nPwn
Joined: 17 Sep 2010
Total Posts: 3197
14 Sep 2011 10:50 PM
Imagine a mega place with that scripting rubbing that often. Make it a function or something. You also have 2 extra ends :P
Report Abuse
nPwn is not online. nPwn
Joined: 17 Sep 2010
Total Posts: 3197
14 Sep 2011 10:50 PM
Running* stupid flood check
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