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 » Scripters
Home Search
 

Seaons Not Regening?

Previous Thread :: Next Thread 
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:16 PM
I have this simple regen script, that if a value in Workspace equals 3 or 4 it wont regenerate, but for some reason it wont work. No output error.

object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then
model = object
backup = model:clone() -- Make the backup
waitTime = 15 --Time to wait between regenerations
wait(math.random(0, waitTime))
while true do
wait(waitTime)
if game.Workspace.Seasons.Value == 1 or 2 then -- Regen wait time
model:remove()
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
elseif game.Workspace.Seasons.Value == 3 or 4 then
print("Too Cold")
end
end
end
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:19 PM
B1
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:20 PM
Just noticed i mispelled Seasons lol.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:26 PM
B2
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:26 PM
#code object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then
model = object
backup = model:clone() -- Make the backup
waitTime = 15 --Time to wait between regenerations
wait(math.random(0, waitTime))
while true do
wait(waitTime)
if game.Workspace.Seasons.Value == 1 or 2 then -- Regen wait time
model:remove()
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
elseif game.Workspace.Seasons.Value == 3 or 4 then
1print("Too Cold")

end
end
end
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
15 Sep 2015 08:29 PM
Post errors next time and proofread your scripts for typos...

"#code object = script.Parent"
should be 'object = script.Parent'

" 1print("Too Cold") "
should be 'print("Too Cold")'

"model:remove()"
should be 'model:Destroy()'
Remove method is deprecated and doesn't actually remove the thing from the game, in a sense it just sets the parent of the object to nil and it'll still be taking up memory until it's cleaned up by the garbage collector.

Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:33 PM
Nevermind, apparently using elseif and only 1 of it, doesn't work. Glad to see im breaking away from Scripters.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:34 PM
@Long
The 1print is because of roblox +.
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
15 Sep 2015 08:34 PM
#code is also roblox+

Don;t i still want to cal on the model to regenerate it? If i Destroy it and everything of it, I wont be able to call it?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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