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

Minigun powerup only repeating once?

So I have powerups in my game but for some reason the minigun isn't working. I want it to shoot rapidly for 5 seconds. I'm not sure what I'm doing wrong here. It only shoots one bullet.

Also how do I make the RocketPropulsion go in a straight line from the minigun? I tried specifying the rocketpropulsion without a target but it just goes to the center of the baseplate.

function Minigun()
	repeat
		local rocket = Instance.new("Part", script.Parent.Physical)
		local propthing = Instance.new("RocketPropulsion",rocket)
		local rocketscript = script.Parent.Physical.RocketScript:Clone()
		local offset = 10
		local fire = Instance.new("Fire")
		rocket.Position = script.Parent.Parent.Position + script.Parent.Parent.CFrame.LookVector*offset + Vector3.new(0,10,0)
		rocket.Size = Vector3.new(1, 1, 4)
		rocketscript.Parent = rocket
		rocketscript.Disabled = false
		rocket.BrickColor = BrickColor.Random()
		fire.Parent = rocketscript
		propthing.CartoonFactor = 1
		propthing.MaxSpeed = 1000
		propthing:Fire()
		warn("Incoming rocket from the Big Rig!")
	until wait(5)
end

4 comments

0

i dont see a wait(5)

0

I put the repeat in the wrong place. I did it again and it still doesn't work. Will update.

0

I put the repeat in the wrong place. I did it again and it still doesn't work. Will update.

0

Hello? Does anybody care about this??????????????????

1 answer

✓ Accepted answer

Howdy!

So, I'm going to partially help with this post because I have not a single clue how RocketPropulsions are done. If someone else wants to tag team this, go ahead.

The condition to end the repeat-until function isn't correct.Try what I got below.

local hold = 0
repeat
	-- Insert code here...
	hold = hold + 1
	wait(0.1) -- The amount of time between gunshots.
until hold == 5
hold = 0

##If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.

##Be sure to check out the Roblox API Documentation as well for additional reference.

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