Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to get good Y Pos for my placement system?

Hello! I'm trying to make model placement system.

But I can't get a good Y pos for this. Can you tell what is the best way to get good Y Pos?

local mouse = game.Players.LocalPlayer:GetMouse()
local model = script.Model:Clone()

model.Parent = workspace
model.PrimaryPart = model.Main

mouse.TargetFilter = model

for _,v in pairs(model:GetChildren()) do
	if v:IsA("BasePart") then
		v.CanCollide = false
		v.Transparency = 0.5
	end
end

game:GetService("RunService").RenderStepped:Connect(function()
	if mouse.Target then
		model:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z))
	end
end)

1 comment

0

What exactly do you mean get good Y?

1 answer

I already found a solution

Just using MoveTo(mouse.Hit.p)

This discussion is preserved as it was. New answers, comments, and votes are closed.