Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you help me with this Mesh script?!

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?

1 comment

0

Question, what is the parent of the mesh?

2 answers

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)

1 comment

0

If this doesn't work, try deleting a parent from line 4.

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)

3 comments

0

There is an error at the End) part...

0

and also I dont understand the Sword thing? The ores that are going through it are called Part, should I change that to, if part then?

0

Yeah.

This discussion is preserved as it was. New answers, comments, and votes are closed.