When i clone Part To workspace, this script doesn't work, why?
script.Parent.Touched:Connect(function(x)
print("Pass 1")
if(x.Parent:FindFirstChild("Humanoid")) then
print("Pass2")
x.Parent.Humanoid:TakeDamage(10)
end
end)
When i clone Part To workspace, this script doesn't work, why?
script.Parent.Touched:Connect(function(x)
print("Pass 1")
if(x.Parent:FindFirstChild("Humanoid")) then
print("Pass2")
x.Parent.Humanoid:TakeDamage(10)
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
8 comments
Does it print pass 1 or pass 2?
no
Can you show the code of it being cloned? And is that script inside of the clone?
do you have discord?
My guess is that you're cloning this part and putting this script inside of the part using a LocalScript. I even tested this, and I did not take any damage, and the server did not print anything. If you're not using a LocalScript then you might have the script disabled by default and simply forgot to enable it.
yes i was using a localscript to enable it so what should i do ?
You should be doing the cloning and parenting of the part and of the script in a server script, not a local script. You should also be enabling the script using a server script.
i fixed it with remote events