Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Moving a part 5 studs away from a players torso?

local player = game.Players.LocalPlayer
local pos = player.Character.Torso.Position


local petsarecool = false
local Weld = Instance.new("Weld") 

local part = Instance.new("Part")
part.Parent = player.Character
part.Size = Vector3.new(1,1,1)
part.Position = player.Character.Torso.Position + Vector3.new(pos,5,pos) 
---- here is the issue how do I make it go 5 blocks away from the player?
Weld.Part0 = player.Character.Torso
Weld.Part1 = part
Weld.Parent = player.Character.Torso



2 answers

I got my answer with help from this past question.

local player = game.Players.LocalPlayer
local pos = player.Character.Torso.Position


local petsarecool = false
local Weld = Instance.new("Weld") 

local part = Instance.new("Part")
part.Parent = player.Character
part.Size = Vector3.new(1,1,1)
part.Position = player.Character.TorsoCFrame *CFrame.new(0,5,0)

Weld.Part0 = player.Character.Torso
Weld.Part1 = part
Weld.Parent = player.Character.Torso

That moves it up. The question I linked would explain how to make it move towards the Torso's lookVector.

Weld.C1 = CFrame.Angles(0, 0, 0) * CFrame.new(0, 0, 0) <<--- Set your Cordinates here

2 comments

0

So I don't need to modify the parts position?

0

so what I would do is, get the player position and set that to a variable, and then set it to +5 that number

This discussion is preserved as it was. New answers, comments, and votes are closed.