Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Nuke explodes too early?

Asked by 9 years ago

I made a nuke and want it to detonate 60 seconds after I press a button. However, when I test the game it explodes instantly after I spawn. What would I add to make this work? (Also: The script is rather long and complex)

http://imgur.com/K9rOxNe,owGO5CC,mbmCAXa#0

(NOTE: The script wont show up right so I attached 3 pictures showing it in the link above)

0
I edited my answer. SchonATL 15 — 9y

2 answers

Log in to vote
2
Answered by 9 years ago

EDITED

Try this out:

local button = --locate your button (the button that you press to start explosion)

function a()
    wait(60)
    local explode = Instance.new("Explosion")
    explode.Parent = -- Put the block you want it to start in here
end

button.MouseButton1Down:connect(a)
0
Line 5 is not coded correctly. TheeDeathCaster 2368 — 9y
0
For some reason this does not work. Can you explain the locate your button part and what I type specifically? Reserected 0 — 9y
0
Ok. So I tried this and it says error: Unexpected symbol near end, even though there's nothing there. Reserected 0 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

I am not sure what exactly is wrong with the code, but I found a few problems that may be the source of the issue.

Line 47: function Open()end

There is not supposed to be an end there. Right now, the function "Open" has no code in it. Remove that end and place it near at the end of the function.

Line 91: Button.ClickDetector.MouseClick:connect(function() Open() end)

This is close, but not exactly right. When calling a function with a connect line, you only need to say the name of the function. No need to over complicate things! This is how it should be:

Button.ClickDetector.MouseClick:connect(Open)

Hopefully this helps! If you have any other issues, feel free to contact me by commenting or sending me a message on Roblox! Good luck, and happy coding!

0
I did the above and now it says, " 'end' expected (to close 'function' at line 47) near '<eof>' " Reserected 0 — 9y
0
Like I said in the answer, make sure that you have an end at the end of the function. This error is just saying that you don't have an end for the function at line 47. Add that, and it should work. User#348 0 — 9y
0
Im sorry, but Im a bit confused. By the end of the function, do you mean at the end of line 47? Or where it ends at about line 53... Reserected 0 — 9y
0
I guess I forgot to specify. By the end of the function, I mean after all of the code that is in the function. Whenever you want your function to have no more code, put the end there. User#348 0 — 9y
View all comments (3 more)
0
One more thing, remove line 73 and line 87. That's another issue. User#348 0 — 9y
0
Ok. The good news is im not getting any more errors! The bad thing is it still detonates right when I spawn. Sorry for bothering you! Reserected 0 — 9y
0
It's no problem at all! I will look into this a bit more and get back to you once I find something. User#348 0 — 9y

Answer this question