function GetMousePoint(X, Y)
--local RayMag1 = Camera:ScreenPointToRay(X, Y) --Hence the var name, the magnitude of this is 1.
--local NewRay = Ray.new(RayMag1.Origin, RayMag1.Direction * 1000)
--local Target, Position = workspace:FindPartOnRay(NewRay, Player.Character)
--return Position
return Mouse.Hit.Position
end
local PlaceAsset = RoadPack:FindFirstChild(PickedValue.Value):Clone()
PlaceAsset.Parent = workspace
if PlaceAsset:IsA("Model") then
print(GetMousePoint(Mouse.X, Mouse.Y))
PlaceAsset:SetPrimaryPartCFrame(CFrame.new(GetMousePoint(Mouse.X, Mouse.Y) ) *CFrame.Angles(math.rad(PlaceAsset.PrimaryPart.Orientation.X),math.rad(PlaceAsset.PrimaryPart.Orientation.Y), math.rad(PlaceAsset.PrimaryPart.Orientation.Z)))
else
PlaceAsset.Position = GetMousePoint(Mouse.X, Mouse.Y)
end
https://gyazo.com/6d7253a68175029355f130bcbccd998b
This is my script which takes a model (or a part) and duplicates it to the mouse position where clicked.
The issue: Mouse.Hit.P Is returning a position thats INSIDE the part, as you can see in the video, the model is spawning with only the top of the model sticking out, the rest is below inside the part.
How would I fix it to move it up enough to make sure the bottom is on top of the part?