Here is my damage script. It is put inside the bullet when it is fired. I have tried removing the bullet in many different spots but they destroy the script. Please help.

script.Parent.Touched:Connect(function(hit)
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, h, mouse)
		if hit.Name == "Handle" then return end
		local h = hit.Parent:FindFirstChild("Humanoid")		
		if h  then
			if hit.Parent.Name ~= plr.Name then		
				h:TakeDamage(10)
			end
		end
end)
end)

6 comments

0

Do not pass the mouse on a server script

0

You can destroy the bullet since there's no bullet.

0

can't *

0

Destroy() destroys a part AND all of its children, so if the script is inside the bullet, it also is destroyed

0

Plus you don't need to put a script inside.

0

When you raycast, it return hit, position (and two other CFrame stuff). Hit is where it hits, and position is where it is.