Making a placing blocks script but the preview object keeps facing the camera which is kinda annoying, does anyone know a fix? I’ve tried using CFrame inverse and objectToWorldSpace but I seemed to fail.
https://gyazo.com/c1a067ac42466cee78eead6eb7d19177
tool.Equipped:Connect(function()
Placed[Player] = false
Previewing = true
Object = Player.Character:WaitForChild("Object")
for i, v in ipairs(Placeable:GetChildren()) do
if v.Name == Object.Value then
if v:IsA("Model") then
Preview = v:Clone()
Preview.Parent = workspace
table.insert(PrePart, 1, Preview)
for i, b in ipairs(Preview:GetChildren()) do
b.Transparency = 0.5
b.BrickColor = BrickColor.new("Bright green")
b.Anchored = true
b.CanCollide = false
end
Mouse.Move:Connect(function() -- this is the part where the object is position
if Placed[Player] == false then
Mouse.TargetFilter = Preview.PrimaryPart
Preview:SetPrimaryPartCFrame(Mouse.Hit)
end
end)
end
end
if v:IsA("Part") then
end
end
end)