Hey, I currently have this script -
bin = script.Parent function onTouched(part) script.Parent.Parent.Mesh:clone().Parent = part end connection = bin.Touched:connect(onTouched)
This script is for my tycoon, it changes the ores mesh to an other mesh (Sword) . This works fine and dandy, its just that when a Humanoid passes through it also ends up getting there body turned into that mesh to... If you know, can you please give me a solution to this problem?
Welp, I don't understand your variable 'connection' but whatever. Here's how I picture it looking:
bin = script.Parent function onTouched(part) bin.Parent.Mesh:Clone().Parent = part end bin.Touched:connect(onTouched)
Firstly, I would use Touched Event Parameter to see if the Object that set off the function is the same Name as your Sword name.
script.Parent.Touched:connect(function(Hit) local Sword = Hit.Parent:FindFirstChild("SWORD")--Replace the word "SWORD" with the actual sword Name. if Sword then--If it is the Name of your sword then... bin.Parent.Mesh:Clone().Parent = part end)