Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you help me with this Mesh script?!

Asked by 8 years ago

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?

0
Question, what is the parent of the mesh? deputychicken 226 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

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)
0
If this doesn't work, try deleting a parent from line 4. deputychicken 226 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

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)
0
There is an error at the End) part... TixyScripter 115 — 8y
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? TixyScripter 115 — 8y
0
Yeah. UserOnly20Characters 890 — 8y

Answer this question