Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How should I damage players with my fireball?

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?

2 answers

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!

5 comments

0

Awesome! So it's better to have it in a second script inside the fireball instead of just using .Touched in the same script you create the part in?

0

Are you talking about an Instance.new script and then putting the code inside of the same script?

0

uh let me see if I can explain it a little clearly.

0

If you are then nah, In my opinion Create a second script as the child of the Instance script then in the instance script type in a code like "script.Parent."Damage Script".Parent = game.Workspace.Fireball

0

check my other comment c:

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.