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

Setting the CFrame on a model spawns it in the ground a bit?

Asked by 4 years ago
local player = game.Players.LocalPlayer

local Mouse = player:GetMouse()





Mouse.Button1Down:Connect(function()

local part = game.ReplicatedStorage.Model:Clone()

part:SetPrimaryPartCFrame(CFrame.new(Mouse.Hit.Position))

part.Parent = workspace

end)

Everytime I click, it spawns in workspace, but some of it spawns inside the ground. How do I fix this?

1 answer

Log in to vote
0
Answered by
Fad99 286 Moderation Voter
4 years ago

You Might want to add an off set, to do that you add a vector 3 Value onto the CFrame. For Example:

part:SetPrimaryPartCFrame(CFrame.new(Mouse.Hit.Position)) + Vector3.New(0,1,0) 

This Offset will Make the CFrame 1 stud Higher than it usually is

Ad

Answer this question