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
Do not pass the mouse on a server script
You can destroy the bullet since there's no bullet.
can't *
Destroy() destroys a part AND all of its children, so if the script is inside the bullet, it also is destroyed
Plus you don't need to put a script inside.
When you raycast, it return hit, position (and two other CFrame stuff). Hit is where it hits, and position is where it is.