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

Could anyone help me fix the FireBall Script?

Asked by 9 years ago

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

Log in to vote
0
Answered by
debugd 5
9 years ago

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

Ad

Answer this question