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: Randomly timed regen...

Previous Thread :: Next Thread 
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
02 Dec 2011 10:09 PM
So I'm trying to make it so that a brick with this script takes random amounts of time to wait before regenerating, but it doesn't work...might there be something in the mathrandoms I need to change?

model = script.Parent
messageText = ""

message = Instance.new("Message")
message.Text = messageText
backup = model:clone()



end


while true do
wait(0.1)
m = math.random(1,4)
if m == 1 then
wait(0.7)
message.Parent = game.Workspace
model:remove()

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil)
else if m == 2 then
wait(0.9)
message.Parent = game.Workspace
model:remove()

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
else if m == 3 then
wait(1.1)
message.Parent = game.Workspace
model:remove()

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil)
else if m == 4 then
wait(1.3)
message.Parent = game.Workspace
model:remove()

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
end
end
end
end
end
Report Abuse
jessemccullough9292 is not online. jessemccullough9292
Joined: 10 Jul 2008
Total Posts: 590
02 Dec 2011 10:24 PM
All I did is just put the end's where they belong...
model = script.Parent
messageText = ""

message = Instance.new("Message")
message.Text = messageText
backup = model:clone()


while true do
wait(0.1)
m = math.random(1,4)
if m == 1 then
wait(0.7)
message.Parent = game.Workspace
model:remove()
end

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
else if m == 2 then
wait(0.9)
message.Parent = game.Workspace
model:remove()
end

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
else if m == 3 then
wait(1.1)
message.Parent = game.Workspace
model:remove()
end

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
else if m == 4 then
wait(1.3)
message.Parent = game.Workspace
model:remove()
end

wait(0.1)

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
end
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
02 Dec 2011 10:39 PM
Greatt suggestion, but it didn't work.
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 07:17 AM
Bump
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 07:44 AM
I decided to try this, but it still doesn't work...

bricks = script.Parent
backup = bricks:clone()
message = Instance.new("Message")
message.Text = ""

while true do
print("Regen")
m = math.random(1,4)
wait(0.01)
if m = 1 then
wait(0.8)
bricks:Remove()
message.Parent = game.Workspace
wait(0.01)
bricks = backup:clone()
bricks:makeJoints
message:Remove()
end

if m = 2 then
wait(1)
bricks:Remove()
message.Parent = game.Workspace
wait(0.01)
bricks = backup:clone()
bricks:makeJoints
message:Remove()
end

if m = 3 then
wait(1.2)
bricks:Remove()
message.Parent = game.Workspace
wait(0.01)
bricks = backup:clone()
bricks:makeJoints
message:Remove()
end

if m = 4 then
wait(1.4)
bricks:Remove()
message.Parent = game.Workspace
wait(0.01)
bricks = backup:clone()
bricks:makeJoints
message:Remove()
end



end
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 01:54 PM
Help...
Report Abuse
jessemccullough9292 is not online. jessemccullough9292
Joined: 10 Jul 2008
Total Posts: 590
03 Dec 2011 01:56 PM
Change to "if WhatEverNumber == m then"

Use two ='s when comparing...
Report Abuse
jessemccullough9292 is not online. jessemccullough9292
Joined: 10 Jul 2008
Total Posts: 590
03 Dec 2011 01:57 PM
Also it's "brick:makeJoints()" Not "brick:makeJoints"...
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 02:00 PM
Can't believe I forgot to do that...
but it's still not working...
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 02:00 PM
Wait, I think it works now! Thanks :D
Report Abuse
jessemccullough9292 is not online. jessemccullough9292
Joined: 10 Jul 2008
Total Posts: 590
03 Dec 2011 02:01 PM
No problem.
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 02:13 PM
Wait....the object's able to remove itself but it doesn't come back! ._.
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 02:13 PM
Nvm I know why...
Report Abuse
pokemaniacX is not online. pokemaniacX
Joined: 27 Apr 2008
Total Posts: 13487
03 Dec 2011 02:16 PM
Gah! It's still removing itself and not coming back! D:
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