Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Emergency coolant is not working?

Hello Iv made a Emergency coolant script But When Meltdown starts its auto starts and and it should work on a certion time eg 30 seconds left here is my script

if workspace:FindFirstChild("EmergencyGlass")~= nil then
game.Workspace.EmergencyGlass:Destroy()
end
local g = Instance.new("Hint",game.Workspace)
			g.Text = "Emergency coolant activated!"
	wait(19)
			g:Destroy()
	local msg = Instance.new("Message")
msg.Parent = game.Workspace
msg.Name = 'OMG'
msg.Text = "Self destruct sequence aborted."
wait(24)
msg.Text = "Warning Coolant unable to reach core. Self Destruct sequence re-intiated."
game.Workspace.Gate.Countdown.Value.Value =40
wait(14)
if game.Workspace:FindFirstChild("OMG")~=nil then
game.Workspace.OMG:remove()
end
game.Workspace.Gate.Countdown.Disabled = true

3 comments

2

Could you explain slightly clearer please? So, which part should wait 30 seconds?

0

What? On line 1 and 2, your basiclly saying that if the glass does not exist then remove the glass

0

No, the line is checking to see if it exists. If it exists, it gets removed. Those two lines actually make sense.

2 answers

I'm struggling to understand your question here, but if you want to wait a certain amount of time that is in a value, you could do something like:


local value = game.Workspace.Wait.Value

wait(value) --This will wait however long the value is - make sure it is a NumberValue or IntValue!

For the button pressing, you could use a ClickDetector in a brick

function onClicked(playerWhoClicked)
    --Run the cooldown/meltdown function
end
 
script.Parent.ClickDetector.MouseClick:connect(onClicked)

So the full script would be:

function onClicked(playerWhoClicked)
    --Run the cooldown/meltdown function
if workspace:FindFirstChild("EmergencyGlass")~= nil then
	game.Workspace.EmergencyGlass:Destroy()
end
local g = Instance.new("Hint",game.Workspace)
        g.Text = "Emergency coolant activated!"
    	wait(19)
        g:Destroy()
    	local msg = Instance.new("Message")
	msg.Parent = game.Workspace
	msg.Name = 'OMG'
	msg.Text = "Self destruct sequence aborted."
	wait(24)
	msg.Text = "Warning Coolant unable to reach core. Self Destruct sequence re-intiated."
	game.Workspace.Gate.Countdown.Value.Value =40
	wait(14)
	if game.Workspace:FindFirstChild("OMG")~=nil then
		game.Workspace.OMG:remove()
	end
game.Workspace.Gate.Countdown.Disabled = true
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

If this helps, please "Accept Answer" - if not, be sure to comment with another clearer explanation of what you mean!

How can i explain this So my Reactor Core runs off a master script Knows as gate it controls everything my countdown uses a Value to Work

13 comments

1

Make sure you answer stuff like this in the comments, rather than "Answers".

0

The Emergency script is also connected to gate what im trying to do it i want players to activate emergency coolant by pressing a Button

0

So basicly im trying to connect the Emergency script to a button so players can activate it while in meltodown

1

Read my answer about the clickdetector and see if that helps.

0

Is it Possible to Show Video's here so its better to look at my problem?

0

Yes, but have you tried my script? It will allow a player to press a clickdetector and then run the script.

0

im going to try it Now

0

OK! Make sure you put a ClickDetector in the part and then put that script in the ClickDetector!

0

Btw The Button is on a different script

0

If you put the script in the ClickDetector it should work.

0

I did and its activates meltdown :/

0

Well, what do you want it to do then? If that script is a meltdown script, it will activate it!!

0

It suposed to add 120 for players

This discussion is preserved as it was. New answers, comments, and votes are closed.