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

Spawn object 10 blocks up and in front of the players torso?

Asked by 4 years ago

I have a script that is supposed to place a brick above and in front from the player's torso. I believe I can achieve this with LookVectors, but I every attempt doesn't work. Any help is appreciated.

0
This is not a request site. Please provide us code so we can make changes and point out errors to help you CreationNation1 459 — 4y
0
I didn't realise my post was requesting code. Just asked how to modify CFrames using LookVectors. Dreadd15 4 — 4y

1 answer

Log in to vote
0
Answered by
Necro_las 412 Moderation Voter
4 years ago
Edited 4 years ago

You can reference a parts "front" side by using cframe look vector like this:

local studsForward = 10
local createdPart = Instance.new("Part", workspace)
createdPart.CFrame = Part.CFrame + Part.CFrame.LookVector * studsForward

-- add 10 studs above with Vector3
createdPart.Position = createdPart.Position + Vector3.new(0,10, 0)
Ad

Answer this question