I made a function where when you press f 8 red bullets are shot from your character(with fire on them) I want them to do damage but I have no idea how, can anyone help? Also, this only works in Studio, not on a server. When I try to play it on a server is says " Players.Player1.Backpack.LocalScript:5: attempt to index field 'Character' (a nil value)"
Player = game.Players.LocalPlayer
Char = Player.Character
Torso = Player.Character.Torso
Mouse = Player:GetMouse()
Attack = false
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 * 100
wait(.05)
end
wait(4)
for _, v in pairs(game.Workspace:GetChildren()) do
if v.Name == "Bullets" then
v:Destroy()
end
end
wait(1)
Attack = false
end
end)

3 comments
Thanks, but his code will differ because he wants to damage, not instakill.
He should know how to change the damage variable. I haven't thoroughly checked the blog post, I'll do that now.
I just updated the post to include taking damage for lava bricks, in the sense of a time delay for additional damage to the player. I'll get into how I did that for the newer guys in a future post.