MoveTo() works only for models. So, instead you can move this tool in two different ways, with CFrame, or Position. Due to the tool probably being anchored, you'll want to use Position. All of the code appears to be fine, execept line 12 may confuse the script due to two functions of the same name existing! Also, they both are called at the same event, you should change the function name and event for 1! Something like that as a fix, I do not know what would happen if you did not change what I mention.
Anyway, here is your script for positioning the tool:
function click()
local weapon = game.ReplicatedStorage:FindFirstChild("KF5"):clone()
weapon.Part.Position = Vector3.new(42.5,628.8,48.5)
end
script.Parent.MouseButton1Click:connect(click)
function click()
local weapon = game.ReplicatedStorage:FindFirstChild("ARX-160"):clone()
weapon.Part.Position = Vector3.new(42.5,628.8,48.5)
end
script.Parent.MouseButton1Click:connect(click)
I am assuming "Part" is the correct name of the part inside tool, that may need to be fixed if I am wrong.
Now, I am not sure if there is actually more than 1 part inside or not, so position or cframe will cause problems. Then, you will want to model the parts together inside of tool for MoveTo() to work. (I don't believe models will effect anything unless your scripts inside will have a hierarchy error)
In this case, just do what you did but instead of the tool, go further in and to the Model!
function click()
local weapon = game.ReplicatedStorage:FindFirstChild("KF5"):clone()
weapon.Model:MoveTo(Vector3.new(42.5,628.8,48.5))
end
script.Parent.MouseButton1Click:connect(click)
function click()
local weapon = game.ReplicatedStorage:FindFirstChild("ARX-160"):clone()
weapon.Model:MoveTo(Vector3.new(42.5,628.8,48.5))
end
script.Parent.MouseButton1Click:connect(click)
If this positions strangely, find the middle part for more precise movement and set it as primary part. How? Like this:
game.Workspace.Model.PrimaryPart = MiddlePart
I hope this helped! More information on your part would have also helped, but I did what i could with what I had.
2 comments
It doesnt show anymore errors. But it still doesnt work.
and its not a model. Its a tool with parts in it.