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

how to make a part appear besides the player?

Asked by
ax_gold 360 Moderation Voter
6 years ago

I know you can multiply CFrame.lookVector with a number to a part's position in order to make a part appear in front or behind another part (in this case the player's torso.) But, I'm wondering how you move it's position to the sides or the player.

Here's a script you can edit if you need to:

local Torso = game:GetService("Players").LocalPlayer.Character:WaitForChild("UpperTorso")
local part = Instance.new("Part")
part.Position =
0
CFrame.rightVector? Also replace "UpperTorso" with "HumanoidRootPart" SuperAndresZ_YT 202 — 6y
0
I used UpperTorso because the part is going to be welded to the player, and is supposed to move with the uppertorso. ax_gold 360 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
local Torso = game:GetService("Players").LocalPlayer.Character:WaitForChild("HumanoidRootPart")
local part = Instance.new("Part")
part.Anchored = true
local NewPos = CFrame.new(5, 0, 0) -- 5 studs to the left of the torso.
part.CFrame = Torso.CFrame:toWorldSpace(NewPos)
part.Parent = workspace
Ad

Answer this question