There are a couple things that are a tad off with this code, but easily fixable.
First off, I'm assuming that you'd meant to make your 'Part' variable local, not name it 'local.Part.' To do that, all we do is replace the dot with a space.
local Part = script.Parent
From there, we need an actual event that will work with clicking your part, which will likely need a ClickDetector.
ClickD = Instance.new("ClickDetector", Part)
ClickD.MouseClick:connect(function()
end)
Also, for movement, I think you'd find using a loop to be more efficient, and much easier than typing out exactly what you want the code to do.
for i = 1, 4 do
Part.Position = Vector3.new(2, 1+i, 2)
wait(0.5)
end
To wrap it up;
local Part = script.Parent
ClickD = Instance.new("ClickDetector", Part)
ClickD.MouseClick:connect(function()
for i = 1, 4 do
Part.Position = Vector3.new(2, 1+i, 2)
wait(0.5)
end
end
Hope this helps ^^
2 comments
Is this right? local Part = script.Parent ClickD = Instance.new("ClickDetector", Part) ClickD.MouseClick:connect(function)() for (i = 1, 4) do Part.Position = Vector3.new(2, 1+i, 2) wait(0.5) end end
That should work, yeah. :) Just make sure to put a bracket beside your last end,.