|
| 31 Mar 2012 10:45 PM |
Joking. It seems as though nobody replies when I don't post a relevant subject.
I need help with a beginners script, because I'm learning how to script and this seems to not be working. No output.
thing = game.Workspace.Part function onTouched wait(0.5) thing.Color = Color3.new(math.random(1,255), math.random(1,255), math.random(1,255)) wait(60) thing.Explode end while true do local p = Instance.new ("Hint") p.Parent = game.Workspace p.Text = "Slayer219 helped me make this epical place!" wait(300) p:Remove() end while true do local thing = Instance.new ("Smoke") wait (60) thing:Remove ()
What this is supposed to do is change the color of the part every 0.5 seconds, make an explosion at the position of the brick every 60 seconds, inserts a hint every 5 minutes saying Slayer219 helped me make this epical place! and finally insert smoke on the part every 10 minutes.
I don't exactly have a guess where i messed up, but I would guess at math.random maybe. |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 10:48 PM |
function onTouched(hit) ALSO script.Parent.Touched:connect(onTouched)
Those are the two obvious mistakes.
+-Fishy |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 10:49 PM |
| Sorry, as I said i'm new to scripting. Actually, just learned the basics today. |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 10:52 PM |
| Is that all? Output wasn't helpful at all,but I just noticed that I didn't enter the coordinates with Vector3.new. either... |
|
|
| Report Abuse |
|
|
| |
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 31 Mar 2012 11:00 PM |
"while true do local p = Instance.new ("Hint") p.Parent = game.Workspace p.Text = "Slayer219 helped me make this epical place!" wait(300) p:Remove() end while true do local thing = Instance.new ("Smoke") wait (60) thing:Remove ()"
Woah... crazy?
Okay... you forgot to close the second loop. Plus, the first while true loop will keep repeating. It will not allow the script to go on to the next loop. |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:02 PM |
| So I need to put everything in 1 loop? |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 31 Mar 2012 11:02 PM |
Also, I don't think a Part has the property color in it. Try BrickColor = BrickColor.random() |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:03 PM |
But i could still use the variable right?
In the first part i made game.Workspace.Part be "thing" |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Mar 2012 11:05 PM |
| So it would be thing = BrickColor.random? |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Mar 2012 11:13 PM |
I think...Should be but I've never dealt with randoms.
+-Fishy |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:14 PM |
| Well i'll try that and add the Vector3.new coordinates for the explosion and the smoke. |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 31 Mar 2012 11:23 PM |
"What this is supposed to do is change the color of the part every 0.5 seconds, make an explosion at the position of the brick every 60 seconds, inserts a hint every 5 minutes saying Slayer219 helped me make this epical place! and finally insert smoke on the part every 10 minutes."
Umm... do you even need the touched function?
Here is what I coded by looking at what you want:
thing = game.Workspace.Part function a() while true do wait(0.5) thing.BrickColor = BrickColor.random() end end
function b() while true do wait(60) Instance.new("Explosion",workspace).Position=thing.Position end end
function c() while true do wait(60*5) local p = Instance.new("Hint",workspace) p.Text = "Slayer219 helped me make this epical place!" wait(1) p:Remove() end end
function d() while true do wait(60*10) local thing = Instance.new ("Smoke",thing) wait(1) thing:Remove() end end
a = coroutine.create(a) coroutine.resume(a) b = coroutine.create(b) coroutine.resume(b) c = coroutine.create(c) coroutine.resume(c) d = coroutine.create(d) coroutine.resume(d) |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 31 Mar 2012 11:26 PM |
Sorry if it is not efficient. I don't know a shorter way to write it. Maybe I could put the function in coroutine.create()... Hmm...
|
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:27 PM |
Alright well now it displayed the hint, but it didn't change the color, explode the Part or make smoke. Heres the updated script:
thing = game.Workspace.Part function onTouched(hit) script.Parent.Touched:connect(onTouched) wait(0.5) thing.Color = BrickColor.new(math.random(1,255), math.random(1,255), math.random(1,255)) game.Workspace.Part.Explosion = Vector3.new(15.5, 0.6, -30) end while true do local p = Instance.new ("Hint") p.Parent = game.Workspace p.Text = "Slayer219 helped me make this epical place!" wait(300) p:Remove() end while true do game.Workspace.Part.Smoke = Vector3.new(15.5, 0.6, -30) wait(60) thing:Remove () end
Still no output. |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 31 Mar 2012 11:28 PM |
Try my script. Although you have to wait like 10 minute for the smokes. |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:30 PM |
Alright, I was hoping to try and make the script on my own, because of the learning concept but I'll just dissect the script.
I'm going to change the wait(600) to wait(10) just to see if it works. |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:32 PM |
And I forgot to mention this all has to happen when Touched.
*Poker Face* |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:33 PM |
| The Part, I mean is Touched. |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 31 Mar 2012 11:33 PM |
o... m... gee. now im confuse... |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 11:35 PM |
| I was confused 10 minutes ago when I started making this script.... |
|
|
| Report Abuse |
|
|
Phellem
|
  |
| Joined: 04 Aug 2011 |
| Total Posts: 1984 |
|
|
| 31 Mar 2012 11:36 PM |
So you want the loops to start once a Part was touched?
|
|
|
| Report Abuse |
|
|
| |
|