I've used it plenty of times and I understand how it works to an extent. But for some reason this time around, the model isn't moving at all. The bounding boxes are working fine around the models and change colours when i'm out of range etc... So that shows that the mouse position is fine.
I've even compared this to another script I made based on moving models and for some reason this time around it just won't move the model for me.
I've left the insert function below from my script that deals with the model following the mouse, thanks for any help.
function Insert() if Clicked == true then return end Clicked = true Placed = false local InsertedObject = game.ServerStorage.Model InsertedObject:Clone().Parent = game.Workspace InsertedObject.PrimaryPart = InsertedObject.Tile local SB = Instance.new("SelectionBox", Player.PlayerGui) SB.Color = BrickColor.new("Teal") SB.Name = "Place" SB.Adornee = InsertedObject.Tile while Placed == false do wait() if (Mouse.Hit.p - Player.Character.Torso.Position).magnitude <= 100 then if InsertedObject.Tile.Position.Y == Spawn.Position.Y+1 then SB.Color = BrickColor.new("Lime green") else SB.Color = BrickColor.new("Grey") end InsertedObject:MoveTo(Vector3.new((Mouse.Hit.p.X+12.5) - (Mouse.Hit.p.X+12.5)%25, Spawn.Position.Y+19, (Mouse.Hit.p.Z+12.5) - (Mouse.Hit.p.Z+12.5)%25)) else SB.Color = BrickColor.new("Lime green") end end end
Since you have a primary part, you should probably use Model::SetPrimaryPartCFrame. It is much more reliable than Model::MoveTo, since you know exactly which part ends at which point.