I'm trying to make a brick appear in front of me where ever I'm standing in any direction. Not sure really where to go. But I do have this much done.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() function MakeBrick() local c = Instance.new("Part") c.BrickColor = BrickColor.new("Bright blue") c.Transparency = 0.5 c.TopSurface = "SmoothNoOutlines" c.BottomSurface ="SmoothNoOutlines" c.Size = Vector3.new(29.13, 15.9, 2) c.Parent = game.Workspace wait(1) c:Destroy() end mouse.KeyDown:connect(function(key) if key == "e" then MakeBrick() end end)
it's inside a local script in the "Backpack" of the player so it should work. If anyone could help that would be awesome!
You can set its CFrame using the CFrame of the LocalPlayer's Character's Torso + lookVector:
c.CFrame = player.Character.Torso.CFrame + player.Character.Torso.CFrame.lookVector*5
You can simply reference your character's CFrame and go from there :)
--Reference character's CFrame c.CFrame = player.Character:GetPrimaryPartCFrame() * CFrame.new(0,0,-5) --Move out 5 units * CFrame.new(0,0,-c.Size.Z/2) --Take size into account