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

How to position model above terrain?

Asked by 5 years ago

Hello,

I'm trying to create a simple survival type game which follows the style that when you move your mouse around a copy of an object follows your cursor allowing you to place buildings in the world. My code is properly moving the object to the x and y coordinates, but it's printing the MOUSE.Target.Position as (0,0,0) everytime and thus the building is below the map. How do I ensure my object is above the Y coordinate of terrain?

`` while wait() and isPlacing do if(MOUSE.Hit and MOUSE.Target) then print(" | "..tostring(MOUSE.Target.Position)); clone:MoveTo(Vector3.new(MOUSE.hit.Position.x, MOUSE.Target.Position.y, MOUSE.hit.Position.z)) end end

0
maybe the thing your mousing over's position is 0,0,0? the8bitdude11 358 — 5y
0
Yeah, you probably don't want the coordinates of the thing the mouse is over, you should do a raycast to get the actual hit location). "Terrain" is a BasePart that is always at 0,0,0 EmilyBendsSpace 1025 — 5y

Answer this question