I'm trying to make a script that will clone a model from lighting and teleport it directly in front of where your player is facing, basically a building system activated by a tool. Problem is, I can't figure out how to cframe an entire model while offsetting it to bring it in front of the player. The furthest I've gotten is directly teleporting the model to the player using SetPrimaryPartCFrame, but that doesn't help with the offset or rotation due to it expecting a Vector3 value. I'm new to scripting and this is what I have written, which is terrible. It may also be jumbled because I kept trying new things. Thank you for any help.
local Tool = script.Parent
local Debris = game:GetService("Debris")
local offset = CFrame.new(0, 0, 10)
local root = game.Players.LocalPlayer.Character.Torso
Tool.Equipped:Connect(function(mouse)
Tool.Activated:Connect(function(mouse)
local woodwall = game.Lighting.WoodWall:Clone()
print("Cloned From Lighting")
woodwall.Parent = game.Workspace
--woodwall:SetPrimaryPartCFrame(woodwall.Center)
woodwall.PrimaryPart = woodwall.Center
Debris:AddItem(woodwall, 10)
local curframe = woodwall.Center.CFrame
local pos = game.Players.LocalPlayer.Character.Torso.CFrame.p
local lv = game.Players.LocalPlayer.Character.Torso.CFrame.LookVector
woodwall:SetPrimaryPartCFrame(CFrame.new(game.Players.LocalPlayer.Character.Torso.CFrame.p))
wait(.01)
woodwall:SetPrimaryPartCFrame(curframe * CFrame.Angles(0, math.rad(90), 0)) --woodwall:SetPrimaryPartCFrame(CFrame.new(game.Players.LocalPlayer.Character.Torso.CFrame.p)) --woodwall:MoveTo(game.Players.LocalPlayer.Character.Torso.CFrame.p)--*Vector3.new(offset), + offset
print("CFramed")
end)
end)

1 comment
Why is the WoodWall in Lighting?