So I have a fireball local script in the players backpack and when u click a key on ur keyboard it triggers a remote event and a script in serverscriptservice answers the remote event. and what that script does is spawn the physical fireball into workspace.

This is the damage script for the fireball part:

local dmg = 15
local debounce = false
local oldplayer = script:GetDescendants()

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
		if not hit.Parent:IsDescendantOf(oldplayer.Character) then
			debounce = true
			hit.Parent.Humanoid:TakeDamage(dmg)
			script.Parent:remove()
		end
	end
end)

I took out the "not" in the IsDescedantOf for testing and it still harms me if I touch it, and it harms the NPC if the NPC touches it. And if I keep the "not" in there like i did above then it doesn't hurt me or the NPC.

2 comments

0

what are the descendants of the script? Is your character parented to a script?

0

the parent of the script is the fireball clone that came from lighting. the character is a parent of the local script that triggers the remote event