I am having an issue when you throw the object, it clones and when it hits a player, it is supposed to damage them. It is a .Touched() function. Any Help?
The Code:
local part = script.Parent
local damage = 10
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
humanoid:TakeDamage(damage)
end
end)

9 comments
Buddy, we need the code; any possible errors that have been thrown too. You can't leave us with an RBXScriptSignal.
I will put the code in
No errors. I have tried to get it to print when it's touched, but nothing
Firstly, a signal should never be encapsulated in an infinite loop, you just need the one my friend. Secondly, you can pre-allocate the Humanoid instead of using :FindFirstChild() twice.
Sorry about the loop. There was no loop before. I left that in by accident
It's always best to use the Debris Service when handling projectiles. You can't allow multiple Instances to remain in the workspace forever, otherwise you'll induce unwanted lag. Furthermore, you'd need to either disconnect the signal, or destroy the projectile upon contact, as the signal will likely fire more than once, ultimately dealing more damage than intended.
The main script clones it, disables the script inside the part, puts the part in the folder and deletes the part after 2 seconds of being cloned
The program needs to remain active in order for the code to execute.
I'm not sure what you mean by that