i’m currently trying to make a build system inside of studio for my game (small island game) and i found the x and y of the mouse-where the part should go- but can’t find the z. I understand that there’s no z property inside of mouse, but I can’t find any other way to do it. i’ve tried
part.CFrame = CFrame.new(mouse.X, mouse.Hit.p.Y + 0.1, mouse.Hit.p.Z)
and
part.CFrame = CFrame.new(mouse.X, mouse.Hit.p.Y + 0.1, mouse.Hit.CFrame.Z)
, but nothing seems to work.
here’s my whole script
local plr = game.Players.LocalPlayer
local PosZ
local mouse = plr:GetMouse()
local uis = game:GetService("UserInputService")
local db = false
local mainpart = game.ReplicatedStorage.buildobjects.floor
local en = false
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q and db == false then
db = true
en = not en
if en == true then
mouse.Button1Down:Connect(function()
local part = mainpart:Clone()
part.Parent = workspace
part.CFrame = CFrame.new(mouse.X, mouse.Hit.p.Y + 0.1, mouse.Hit.p.Z)
end)
end
task.wait(0.1)
db = false
end
end)
please help