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

How do you test a value (true or false) where it's need to be true for start function?

Asked by 6 years ago
Edited 6 years ago

I have a function and a codepad. First you need to type the code before the button works.

But the value is False = 0 True = 1

And when it goes one after typed the code the click function will still not work.

The only problem is the part I added now. The function by itself works fine.

function onClicked()
    local Launch = workspace.RocketOne.CodePad.Launch
    if Launch == 1 then
        script.Parent.ClickDetector.MaxActivationDistance=0
        script.Parent.Parent.Core.A.Volume = 0.4
        script.Parent.Parent.Core.A:Play()
        script.Parent.BrickColor=BrickColor.new("Bright red")
        wait(10)
        script.Parent.Parent.Core.A:Stop()
        script.Parent.Parent.Core.B:Play()
        wait(3)
        script.Parent.Parent.Door.CanCollide=true
        script.Parent.Parent.Door.Transparency=0.75
        wait(0.1)
        script.Parent.Parent.Door.Transparency=0.5
        wait(0.1)
        script.Parent.Parent.Door.Transparency=0.25
        wait(0.1)
        script.Parent.Parent.Door.Transparency=0
        wait(2)
        script.Parent.Parent.Motor.BodyAngularVelocity.AngularVelocity=Vector3.new(0,0.2,0)
        wait(5)
        script.Parent.Parent.Core.Decoupler.Volume = 0.8
        script.Parent.Parent.Core.Decoupler:Play()
        script.Parent.Parent.Booster.Engine1.ParticleEmitter.Enabled=true
        script.Parent.Parent.Booster.Engine1.Smoke.Enabled=true
        script.Parent.Parent.Booster.Engine2.ParticleEmitter.Enabled=true
        script.Parent.Parent.Booster.Engine2.Smoke.Enabled=true
        script.Parent.Parent.Booster.Engine3.ParticleEmitter.Enabled=true
        script.Parent.Parent.Booster.Engine3.Smoke.Enabled=true
        script.Parent.Parent.Booster.Engine4.ParticleEmitter.Enabled=true
        script.Parent.Parent.Booster.Engine4.Smoke.Enabled=true
        script.Parent.Parent.Core.C.Volume = 0.8
        script.Parent.Parent.Core.C:Play()
        script.Parent.Parent.E1.BrickColor=BrickColor.new("Lime green")
        for i = -2, 75,1 do
        wait(0.1)
        script.Parent.Parent.Core.BodyVelocity.Velocity=Vector3.new(0,i,0)
        wait(1)
        end
        wait(25)
        script.Parent.Parent.Booster.Engine1.ParticleEmitter.Enabled=false
        script.Parent.Parent.Booster.Engine1.Smoke.Enabled=false
        script.Parent.Parent.Booster.Engine2.ParticleEmitter.Enabled=false
        script.Parent.Parent.Booster.Engine2.Smoke.Enabled=false
        script.Parent.Parent.Booster.Engine3.ParticleEmitter.Enabled=false
        script.Parent.Parent.Booster.Engine3.Smoke.Enabled=false
        script.Parent.Parent.Booster.Engine4.ParticleEmitter.Enabled=false
        script.Parent.Parent.Booster.Engine4.Smoke.Enabled=false
        script.Parent.Parent.Core.C:Stop()
        script.Parent.Parent.E1.BrickColor=BrickColor.new("Really red")
        wait(0.5)
        script.Parent.Parent.Core.Decoupler:Play()
        script.Parent.Parent.Joint1:Destroy()
        script.Parent.Parent.Joint2:Destroy()
        script.Parent.Parent.Joint3:Destroy()
        script.Parent.Parent.Joint4:Destroy()
        wait(0.5)
        script.Parent.Parent.Engine5.ParticleEmitter.Enabled=true
        script.Parent.Parent.Core.D:Play()
        script.Parent.Parent.Core.BodyVelocity.Velocity=Vector3.new(0,100,0)
        script.Parent.Parent.E2.BrickColor=BrickColor.new("Lime green")
        wait(25)
        script.Parent.Parent.Engine5.ParticleEmitter.Enabled=false
        script.Parent.Parent.Core.D:Stop()
        script.Parent.BrickColor=BrickColor.new("Deep orange")
        script.Parent.Parent.E2.BrickColor=BrickColor.new("Really red")
        wait(2)
        script.Parent.Parent.Joint5:BreakJoints()
        script.Parent.Parent.Core.Decoupler:Play()
        wait(5)
        script.Parent.Parent.Core.E:Play()
        script.Parent.Parent.Engine6.ParticleEmitter.Enabled=true
        script.Parent.Parent.Core.BodyVelocity.Velocity=Vector3.new(0,125,0)
        script.Parent.Parent.E3.BrickColor=BrickColor.new("Lime green")
    end
end

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


1 answer

Log in to vote
1
Answered by 6 years ago

If Launch from workspace.RocketOne.CodePad.Launch is a Value of any sort, you simply need to add .Value to the end of it:

function onClicked()
    local Launch = workspace.RocketOne.CodePad.Launch.Value -- Gets the Value of whatever Launch is
    if Launch == 1 then
0
I kind of already know that just loong time ago I last scripted. =/ MineJulRBX 52 — 6y
Ad

Answer this question