I made a pizza launcher that shoots small pizzas that does massive damage, and I was wondering how to make the projectiles not damage the owner of the tool
Script:
local tool = script.Parent
local Pizza = tool.Pizza
local Debounce = false
local Sounds = {
Theme = tool.Theme,
PizzaTime = tool["Pizza Time"]
}
tool.Activated:Connect(function()
if not Debounce then
Debounce = true
Sounds.PizzaTime:Play()
local PizzaProjectile = Pizza:Clone()
local Attachment = Instance.new("Attachment")
local VectorForce = Instance.new("VectorForce")
Attachment.Parent = PizzaProjectile
PizzaProjectile.Parent = game.Workspace
PizzaProjectile.Handle:Destroy()
VectorForce.Parent = PizzaProjectile
VectorForce.Force = Vector3.new(0,0,-100)
VectorForce.Attachment0 = Attachment
PizzaProjectile.Position = Pizza.Position
PizzaProjectile.Orientation = Pizza.Orientation
PizzaProjectile.CanCollide = true
PizzaProjectile.Trail.Enabled = true
PizzaProjectile.Touched:Connect(function(hit)
local humanoid = hit.Parent:WaitForChild("Humanoid")
if humanoid then
humanoid:TakeDamage(math.random(30.444444449999999999,70.9999999999444444444))
--Originally does 10 damage due to It originally being spammable, but due to lag, I had to not make It spammable
PizzaProjectile:Destroy()
end
end)
game:GetService("Debris"):AddItem(PizzaProjectile,3)
game:GetService("Debris"):AddItem(VectorForce,0.5)
game:GetService("Debris"):AddItem(Attachment,0.5)
wait(3)
Debounce = false
end
end)
tool.Equipped:Connect(function()
Sounds.Theme:Play()
tool.Unequipped:Connect(function()
Sounds.Theme:Stop()
end)
end)
