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

Can anyone help me fix this script?

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)

1 comment

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.

1 answer

You forgot to make the debounce to true then false?

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