COMBAT
Fireball Projectile
Paste as a Script inside a Tool. Click launches a fireball. The blast damages characters around the impact and tags the shooter for Kill / Death Counter.
-- Paste as a Script inside a Tool.
local Players = game:GetService("Players")
local SPEED = 90
local BLAST_RADIUS = 12
local DAMAGE = 25
local COOLDOWN = 1.2
local tool = script.Parent
local cooling = false
local function markKiller(humanoid: Humanoid, player: Player)
local tag = humanoid:FindFirstChild("creator")
if not tag then
tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Parent = humanoid
end
if tag:IsA("ObjectValue") then
tag.Value = player
end
end
tool.Activated:Connect(function()
if cooling then
return
end
local character = tool.Parent
local root = character and character:FindFirstChild("HumanoidRootPart")
if not character or not character:IsA("Model") or not root or not root:IsA("BasePart") then
return
end
cooling = true
task.delay(COOLDOWN, function()
cooling = false
end)
local ball = Instance.new("Part")
ball.Name = "Fireball"
ball.Shape = Enum.PartType.Ball
ball.Size = Vector3.new(2, 2, 2)
ball.Color = Color3.fromRGB(255, 120, 40)
ball.Material = Enum.Material.Neon
ball.CanCollide = false
ball.CFrame = root.CFrame * CFrame.new(0, 0, -4)
ball.AssemblyLinearVelocity = root.CFrame.LookVector * SPEED
ball.Parent = workspace
local exploded = false
local function explode()
if exploded then
return
end
exploded = true
local position = ball.Position
ball:Destroy()
local player = Players:GetPlayerFromCharacter(character)
for _, inst in ipairs(workspace:GetDescendants()) do
if inst:IsA("Humanoid") and inst.Health > 0 then
local model = inst.Parent
local targetRoot = model and model:FindFirstChild("HumanoidRootPart")
if targetRoot and targetRoot:IsA("BasePart") and model ~= character then
if (targetRoot.Position - position).Magnitude <= BLAST_RADIUS then
if player then
markKiller(inst, player)
end
inst:TakeDamage(DAMAGE)
end
end
end
end
end
ball.Touched:Connect(function(hit)
if hit:IsDescendantOf(character) then
return
end
explode()
end)
task.delay(4, function()
if ball.Parent then
explode()
end
end)
end)