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: Regen script (timed)

Previous Thread :: Next Thread 
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 06:27 PM
--Im not going to lie, i borrowed this from someone else :P
--Won't regen with no outputs, I wanted to remove the message because I think they look ugly and take away from your game's realism so i did and it wont work
--What happened to it? D:

object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then
model = object

if game.Workspace.Alarm.Light1.PointLight.Enabled == true then
backup = model:clone()
waitTime = 1
wait(math.random(0, waitTime))
while true do
wait(waitTime)
end

message.Parent = game.Workspace
model:remove()

wait(2.5)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
end
end

print("Regenerated!")
Report Abuse
AwsomeGuy6190 is not online. AwsomeGuy6190
Joined: 26 Nov 2010
Total Posts: 5842
01 Jun 2013 06:29 PM
message.Parent = game.Workspace

No message makes it not work

I think
Report Abuse
zakary99 is not online. zakary99
Joined: 19 Jan 2010
Total Posts: 1095
01 Jun 2013 06:37 PM
message = Instance.new("Message")
object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then
model = object

if game.Workspace.Alarm.Light1.PointLight.Enabled == true then
backup = model:clone()
waitTime = 1
wait(math.random(0, waitTime))
while true do
wait(waitTime)
end

message.Parent = game.Workspace
model:remove()

wait(2.5)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
end
end

print("Regenerated!")

Ooooo, bio electric dampening field with a retrogressive arc inversion. Follow me on Twitter @RBX_Zakary99
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 06:49 PM
Didnt work :l
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 06:52 PM
After this line:

'model:remove() '

The script won't run. You realize that?

Because if the script is inside the model, and the model gets destroyed, so does the script.

Also, the line where it says:

'message.Parent = game.Workspace'

Should be removed, as the message no longer exists.

Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 06:52 PM
So just get rid of those two lines?
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 06:54 PM
Getting rid of the model:Remove() line will not delete the old model in that case.

Your best bet is putting it at the end.

However, just to make sure it works, you might want to remove those two lines as just a test.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 06:56 PM
Yea didnt work so i'll put it at the bottom. Also, should I delete the line that says something like message.Parent = nil
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 06:57 PM
Yep, anything with 'message' in it, you should get rid of, because the message no longer exists.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 06:58 PM
Okay. Got rid of the model and didnt come back
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 06:59 PM
Did it print 'Regenerated'?
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:03 PM
No, and it removed the model when i spawned
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:04 PM
I mean it didnt wait for the pointlight to be enabled
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 07:04 PM
Oh I see the problem now. Give me a second to find a way to fix it.
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 07:05 PM
Hmm, can you post the current script so I can go off that?

Thanks.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:05 PM
kk
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:06 PM
object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then
model = object

if game.Workspace.Alarm.Light1.PointLight.Enabled == true then
backup = model:clone()
waitTime = 1
wait(math.random(0, waitTime)) --is from here to 'end' necessary?
while true do
wait(waitTime)
end

wait(2.5)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
end
end

print("Regenerated!")

model:remove()
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 07:08 PM
Ok, so I'm going to rewrite the script.

Is it when the PointLight is enabled, you want the regen to happen?

Just double-checking if that is what you want.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:09 PM
Yes
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 07:14 PM
object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then

model = object

repeat wait(.1) until game.Workspace.Alarm.Light1.PointLight.Enabled == true
backup = model:clone()
waitTime = 1
wait(waitTime)

model = backup:clone()
model.Parent = game.Workspace
model:MakeJoints()
end
end

print("Regenerated!")

object:Destroy()

That should work.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:18 PM
Its not, i cant post the output because roblox is having a weird error :/
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:19 PM
Workspace. Alarm. Regen: 15: 'eof' expected near 'end'
there we go
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
01 Jun 2013 07:20 PM
There is an extra 'end'.

Take out one of them.
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:23 PM
Okay uhm is there a way to keep the original copy to paste over and over again? Im hooking it up to a button and breaking glass and every second the glass regens half falling over, falls over, then regens fallen over and so on
Report Abuse
neverhammer is not online. neverhammer
Joined: 13 Sep 2009
Total Posts: 963
01 Jun 2013 07:24 PM
I guess in theory making the glass break after it copies is a good way of doing that
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