Ok so I have a script which is not working there are no errors with it so what I need it to do is move a block to a position when a different block is clicked.
When I click the block it does move the block just to a area witch it is not meant to it goes right on top of a model not in it.
Here is the script
Part = script.Parent
Model = game.Workspace:WaitForChild(“Water”)
If you do not want to account for collisions, use :SetPrimaryPartCFrame() and insert a cframe of the Vector3 position you would want to move it to, like:
If you need to maintain the original orientation of the model you can instead use an instance method which does not alter/modify/change the orientation of the model.
local Part = script.Parent
local Click = Part.ClickDetector
local Model = workspace:WaitForChild("Water")
Click.MouseClick:Connect(function()
task.wait(2)
Model:TranslateBy(Vector3.new(0, -10, 0))
task.wait(2)
Model:TranslateBy(Vector3.new(0, 0.5, 0))
task.wait(2)
Model:TranslateBy(Vector3.new(0, 5.5, 50.5))
task.wait(2)
Model:TranslateBy(Vector3.new(0, 0.5, 0))
task.wait(5)
Model:TranslateBy(Vector3.new(0, -6, -50.5))
end)
For the thread’s poster, consider using more uniform numbers (0.5, 1, 1.5 etc.) with as few decimal places as possible, this is to improve the code’s readability.
Doesn’t TranslateBy move using an offset?
If you were doing this and you wanted the original positions you’d have to do something along the lines of Model:GetPivot():ToObjectSpace(CF).Position
That’s worse imo