local theEvent = game.ReplicatedStorage:WaitForChild("Itachi"):WaitForChild("Z")
theEvent.OnServerEvent:connect(function(plr)
theTouch = false
p = Instance.new("Part")
p.Name = plr.Name
p.Size = Vector3.new(8,8,8)
p.CFrame = plr.Character.Torso.CFrame*CFrame.new(0,0,-5)
p.Anchored = false
p.CanCollide = true
p.Shape = "Ball"
p.BrickColor = BrickColor.new("Br. yellowish orange")
p.Transparency = 0.95
local f = Instance.new("Fire", p)
f.Size = 40
f.Heat = -25
p.Parent = game.Workspace
local z = Instance.new("BodyVelocity", p)
z.maxForce = Vector3.new(math.huge, math.huge, math.huge)
z.velocity = plr.Character.HumanoidRootPart.CFrame.lookVector*50
game.Debris:AddItem(p, 3)
p.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if hit.Parent.Name ~= p.Name then
if theTouch == false then
theTouch = true
game.Debris:AddItem(p, 0)
local ef = Instance.new("Fire")
ef.Parent = hit
ef.Size = 10
for i = 1, 20 do
local h = hit.Parent:FindFirstChild("Humanoid")
h.Health = h.Health - 1
wait(0.01)
end
game.Debris:AddItem(ef, 0)
end
end
end
end)
end)
I'm checking Damage and Creating the Part in the same script, this works perfectly, my question is- Would it be better to do this or to actually just add the damages script to the part and enabled it on fire? |