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

My Emergency coolant is not working?

Asked by 8 years ago

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

2
Could you explain slightly clearer please? So, which part should wait 30 seconds? jjwood1600 215 — 8y
0
What? On line 1 and 2, your basiclly saying that if the glass does not exist then remove the glass SH_Helper 61 — 8y
0
No, the line is checking to see if it exists. If it exists, it gets removed. Those two lines actually make sense. P100D 590 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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!

Ad
Log in to vote
-2
Answered by 8 years ago

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

1
Make sure you answer stuff like this in the comments, rather than "Answers". jjwood1600 215 — 8y
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 drjamesdawson350 0 — 8y
0
So basicly im trying to connect the Emergency script to a button so players can activate it while in meltodown drjamesdawson350 0 — 8y
1
Read my answer about the clickdetector and see if that helps. jjwood1600 215 — 8y
View all comments (9 more)
0
Is it Possible to Show Video's here so its better to look at my problem? drjamesdawson350 0 — 8y
0
Yes, but have you tried my script? It will allow a player to press a clickdetector and then run the script. jjwood1600 215 — 8y
0
im going to try it Now drjamesdawson350 0 — 8y
0
OK! Make sure you put a ClickDetector in the part and then put that script in the ClickDetector! jjwood1600 215 — 8y
0
Btw The Button is on a different script drjamesdawson350 0 — 8y
0
If you put the script in the ClickDetector it should work. jjwood1600 215 — 8y
0
I did and its activates meltdown :/ drjamesdawson350 0 — 8y
0
Well, what do you want it to do then? If that script is a meltdown script, it will activate it!! jjwood1600 215 — 8y
0
It suposed to add 120 for players drjamesdawson350 0 — 8y

Answer this question