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

Could anyone help me fix the FireBall Script?

I took All your advice, trying to pile the script together, but I need help fixing everything now. Can you guys tell me whats wrong with this?

Player = game.Players.LocalPlayer

repeat
    wait() until Player.Character

Char = Player.Character

Torso = Player.Character.Torso

Mouse = Player:GetMouse()

Attack = false

Debris = game:GetService("Debris")

Mouse.KeyDown:connect(function(key)
	local key  = key:lower()
	if key == "f" and (not Attack) then
		Attack = true
	   for i = 0, 8, 1 do
	        local Ball = Instance.new("Part")
	        Ball.Name = "Bullets"
            Ball.Parent = game.Workspace
            Ball.Shape = "Ball"
            Ball.Size = Vector3.new(1,1,1)
            Ball.Transparency = .4
            Ball.TopSurface = "Smooth"
            Ball.BottomSurface = "Smooth"
            Ball.BrickColor = BrickColor.new("Really red")
            Ball.CFrame = Torso.CFrame * CFrame.new(0,0.5, -5)
            Ball.CanCollide = false
            local Fire = Instance.new("Fire")
            Fire.Parent = Ball
            local Bv = Instance.new("BodyVelocity")
            Bv.Parent = Ball
            Bv.maxForce = Vector3.new(math.huge,math.huge,math.huge)
            Bv.velocity = Torso.CFrame.lookVector * 250
            local connection = Ball.Touched:connect(function(hit)
            local PlayerIsFound = game:GetPlayerFromCharacter(hit.Parent)
            if PlayerIsFound then
            local HumanoidIsFound = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
            if HumanoidIsFound then
            HumanoidIsFound:TakeDamage(5)
        end
    end
end) 
            wait(.05)
            Debris:AddItem("Ball", 3)
       end
           end
           Attack = false
end)

1 answer

When you parent the Ball instance into the workspace, you name it "Bullets".

AddItem takes an instance, so you need to grab it from the workspace using that name and then use it as a parameter to AddItem instead of the string.

local bullets = game.Workspace.Bullets
Debris:AddItem(bullets, 3)

Cool script, debugd

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