Basically I've created a script that launches a fireball in-front of the player but I'm not entirely sure what would be the most effective way to damage other players with it.
Should I create a script and put it inside the fireball when it launches.. that would damage the player using .Touched.
Or should I use a .Touched function in my server script that create the fireball itself?
I'd recommend using the .Touched event for the fireball like this.
script.Parent.Touched:Connect(function(touch) touch.Parent:FindFirstChild("Humanoid") if touch ~= nil then touch:TakeDamage(30) (or Something like that) end end)
Im not too sure this would work but Ye, I hope this works for you!
Basically,
Which one of these is better to use.
Script inside ServerScript that creates Fireball
p = Instance.new("Part") p.Size = Vector3.new(2,2,2) p.Parent = game.Workspace p:Touched:Connect(function(touch) if touch.Parent:FindFirstChild("Humanoid") ~= nil then touch:TakeDamage(30) end end)
OR
Script which has been copied into the Fireball itself.
p = script.Parent p:Touched:Connect(function(touch) if touch.Parent:FindFirstChild("Humanoid") ~= nil then touch:TakeDamage(30) end end)