Post12346
|
  |
| Joined: 21 May 2011 |
| Total Posts: 323 |
|
|
| 07 Nov 2014 04:44 PM |
function Touch(onHit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then spawn:regenerate() spawn:message() --This next end end end script.Parent.Touched:connect(Touch) |
|
|
| Report Abuse |
|
|
|
| 07 Nov 2014 04:46 PM |
There is more, right?
Do an end check. |
|
|
| Report Abuse |
|
|
Post12346
|
  |
| Joined: 21 May 2011 |
| Total Posts: 323 |
|
|
| 07 Nov 2014 04:51 PM |
Okay, it is a full regen script, but I must warn you, it is very, very long
--[[Post12346 Plese don't change unless you know what you're doing. This work took me over 3 hours Enjoy --]] model = game.workspace.RTR2014 backup = model:clone() enabled = true function regenerate() while true do wait(3) model = backup:clone() model.Parent = game.Workspace model:makeJoints() script.Disabled = true script.Parent.BrickColor = BrickColor.new(26) wait(20) script.Disabled = false script.Parent.BrickColor = BrickColor.new(104) end end function message() while true do message = Instance.new("Message") message.Text = ("Regening Car (20)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (19)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (18)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (17)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (16)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (15)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (14)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (13)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (12)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (11)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (10)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (9)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (8)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (7)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (6)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (5)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (4)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (3)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (2)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (1)") wait(1) message:remove() end end function Touch(onHit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then spawn:regenerate() spawn:message() end end script.Parent.Touched:connect(Touch)
I am trying to get the script to regen a model that is in workspace, have a message that changes every second, and has a total script wait of 20 seconds before the regen button turns on again. I basically took a free model car and took the liberty of removing spaces from all the names, and have them both run in parallel (at the same time.) |
|
|
| Report Abuse |
|
|
Post12346
|
  |
| Joined: 21 May 2011 |
| Total Posts: 323 |
|
|
| 07 Nov 2014 05:02 PM |
| Bump, bump-ba-bump bump... Bump bump! |
|
|
| Report Abuse |
|
|
LucasLua
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 7386 |
|
|
| 07 Nov 2014 05:06 PM |
| It looks like the code has been completely scrambled and broken (infinite while loops in strange places, calling an object (spawn:regenerate; spawn:message) that doesn't exist) and needs revised. You should start from scratch, and should definitely check the roblox wiki tutorials for help (http://wiki.roblox.com). |
|
|
| Report Abuse |
|
|
Post12346
|
  |
| Joined: 21 May 2011 |
| Total Posts: 323 |
|
|
| 07 Nov 2014 05:09 PM |
I checked over 19 pages on the wiki, over 3 hours of time taken to code this (not to mention the hour and thirty minutes waiting for responces) and I still have hardly any coding knowlege.
Having such a downer responce to a newbie is pretty rude. |
|
|
| Report Abuse |
|
|
LucasLua
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 7386 |
|
|
| 07 Nov 2014 05:17 PM |
Sorry if that came off as rude, that's not my intention. The code simply needs rewritten, as it could actually be much smaller. Here are some articles on the wiki that will be of interest to you:
http://wiki.roblox.com/index.php?title=Functions -This information is important. Read it closely.
http://wiki.roblox.com/index.php?title=Loops#For
-Should take you to the for loop section of the loop article, but if not then just find that, don't worry about the other stuff for this particular coding problem you have.
http://wiki.roblox.com/index.php?title=String
- For this one, just stop before the advanced part of the "Math and Strings" section. |
|
|
| Report Abuse |
|
|
Post12346
|
  |
| Joined: 21 May 2011 |
| Total Posts: 323 |
|
|
| 07 Nov 2014 05:18 PM |
Okay, I made a few minor edits as I got errors, and now it runs the function of regenerate, but not the message.
--[[Post12346 Plese don't change unless you know what you're doing. This work took me over 3 hours Enjoy --]] model = game.workspace.RTR2014 backup = model:clone() enabled = true function regenerate() while true do wait(3) model = backup:clone() model.Parent = game.Workspace model:makeJoints() script.Disabled = true script.Parent.BrickColor = BrickColor.new(26) wait(20) script.Disabled = false script.Parent.BrickColor = BrickColor.new(104) end end function message() while true do message = Instance.new("Message") message.Text = ("Regening Car (20)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (19)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (18)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (17)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (16)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (15)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (14)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (13)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (12)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (11)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (10)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (9)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (8)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (7)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (6)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (5)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car (4)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car. (3)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car.. (2)") wait(1) message:remove() message = Instance.new("Message") message.Text = ("Regening Car... (1)") wait(1) message:remove() end end function Touch(onHit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then spawn:regenerate() spawn:message() end end script.Parent.Touched:connect(Touch)
Alongside it actually regening, as soon as the wait is over it makes a new car without me pressing the button.
What now? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 07 Nov 2014 05:20 PM |
| I hate your script with a passion please learn to loop and then come back after you do that. |
|
|
| Report Abuse |
|
|
Post12346
|
  |
| Joined: 21 May 2011 |
| Total Posts: 323 |
|
|
| 07 Nov 2014 05:20 PM |
"Sorry if that came off as rude, that's not my intention. The code simply needs rewritten, as it could actually be much smaller. Here are some articles on the wiki that will be of interest to you:
http://wiki.roblox.com/index.php?title=Functions -This information is important. Read it closely.
http://wiki.roblox.com/index.php?title=Loops#For
-Should take you to the for loop section of the loop article, but if not then just find that, don't worry about the other stuff for this particular coding problem you have.
http://wiki.roblox.com/index.php?title=String
- For this one, just stop before the advanced part of the "Math and Strings" section."
I accept your apology, and I also realize now that my previous post was sent before I read this. Better get to it... |
|
|
| Report Abuse |
|
|
Post12346
|
  |
| Joined: 21 May 2011 |
| Total Posts: 323 |
|
|
| 07 Nov 2014 05:39 PM |
| I dunno, I guess this is somewhat hard for me, I read all three articles, but I still cannot put them to memory sadly. |
|
|
| Report Abuse |
|
|
| |
|