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)

8 comments

0

Does it print pass 1 or pass 2?

0

no

0

Can you show the code of it being cloned? And is that script inside of the clone?

0

do you have discord?

0

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.

0

yes i was using a localscript to enable it so what should i do ?

0

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.

0

i fixed it with remote events