|
| 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 |
|
|
| |
|
|
| 15 Sep 2015 08:20 PM |
| Just noticed i mispelled Seasons lol. |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 15 Sep 2015 08:34 PM |
@Long The 1print is because of roblox +. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|