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

Can anyone help me fix this script?

Asked by 9 years ago
Health = script.Parent.Parent.Parent.Health
Shield = script.Parent.Parent.Parent.Shield
FedPower = script.Parent.Parent.Parent.FedPower
Beam = script.Parent.Parent.VFDualBeam
Beam1 = script.Parent.Parent.VFDualBeam1
Sound = script.Parent.Parent.VFDualSound
Button = script.Parent.Parent.VFDualButton
Status = script.Parent.Parent.VFDualStatus
Effects = script.Parent.Parent.VFDualEffects
Effects1 = script.Parent.Parent.VFDualEffects
debounce = false -- what it starts as, and but this up at the top with the other variables


function Damage()
    if (Shield.Value <=149) then
    Shield.Value = Shield.Value - 6.25
    Health.Value = Health.Value - 10
    elseif (Shield.Value >= 99) then
    Shield.Value = Shield.Value - 6.25
    Health.Value = Health.Value - 15
    elseif (Shield.Value >= 49) then
    Shield.Value = Shield.Value - 6.25
    Health.Value = Health.Value - 20
    elseif (Shield.Value >= 1) then
    Shield.Value = Shield.Value - 6.25
    Health.Value = Health.Value - 25
    end
end

    function Fire()
        if debounce == false then
    Damage(Fire)
    FedPower.Value = FedPower.Value - 20
    Beam.Transparency = 0.2
    Beam1.Transparency = 0.2
    Sound.Firing:Play() 
    Button.ClickDetector.MaxActivationDistance = 0
    Status.BrickColor = BrickColor.new(21)
    Effects.Fire.Enabled = true
    Effects1.Fire.Enabled = true
    Effects.PointLight.Enabled = true
    Effects1.PointLight.Enabled = true
    wait(1.2)
    Beam.Transparency = 1
    Beam1.Transparency = 1
    Effects.Fire.Enabled = false
    Effects1.Fire.Enabled = false
    Effects.PointLight.Enabled = false
    Effects1.PointLight.Enabled = false
    wait(4)
    Button.ClickDetector.MaxActivationDistance = 10
    Status.BrickColor = BrickColor.new(37)
        end
        end

FedPower.Changed:connect(function()
if FedPower.Value <=20 then
debounce = false
elseif FedPower.Value >=20 then 
debounce = true
end
end)




script.Parent.ClickDetector.MouseClick:connect(function() if not debounce then Fire() end end)
0
How is this trigonometry or CFrame? Please tag your question appropriately. Also, if you don't mind, consider adding a caption as to where the script is broken and why the script is broken. Mentioning any errors from the output helps, too. Redbullusa 1580 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

You forgot to make the debounce to true then false?

Ad

Answer this question