I tried creating a new part using a script, but it is supposed to kill the player who touches it, but it doesn't. Here is the code.
function Attack1()
local Random1 = math.random(-100, -46)
local Random2 = math.random(-186, -161)
script.Parent.BrickColor = BrickColor.new("Bright red")
bullet = Instance.new("Part", workspace)
bullet.Shape = Enum.PartType.Ball
bullet.BrickColor = BrickColor.new("Neon orange")
bullet.Material = Enum.Material.Neon
bullet.Position = Vector3.new(Random1, 100, Random2)
bullet.Size = Vector3.new(20, 20, 20)
function onTouch(part)
local humanoid = bullet.Parent:FindFirstChild("Humanoid")
if (humanoid ~= nil) then
humanoid.Health = 0
end
end
script.Parent.Touched:connect(onTouch)
wait(5)
bullet:Destroy()
end
while true do
Attack1()
end
