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

How do I make a part follow the back of character?

Asked by
noammao 294 Moderation Voter
6 years ago

(This is what I have so far, and I know that it is inaccurate.) How do I make the part (asd) float about behind my character?

local run = game:GetService("RunService")
local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character
local CameraPart = game.Workspace.asd



if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end


while run.RenderStepped:wait() do

CameraPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.lookVector + Vector3.new(0,7,10)
cam.CameraSubject = CameraPart
--cam.CFrame = game.Workspace.asd.CFrame
cam.Focus = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
print(CameraPart.Position)

end
0
Welds User#20388 0 — 6y
0
Thanks but I don't know how to use it. noammao 294 — 6y
0
For starters, you want a BodyPosition parented to the part, probably sweetkid01 176 — 6y
0
http://wiki.roblox.com/index.php?title=Weld --> There should be a script on it to weld parts togheter User#20388 0 — 6y

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

You can do something like this, although you shouldn't use a while loop for this, but rather welds or body movers.

local run = game:GetService("RunService")
local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character
local CameraPart = game.Workspace.asd



if not character or not character.Parent then
    character = player.CharacterAdded:wait()
end


while run.RenderStepped:wait() do
    local hrp = player.Character.HumanoidRootPart
    CameraPart.CFrame = hrp.CFrame - hrp.CFrame.lookVector*2
    cam.CameraSubject = CameraPart
    cam.Focus = hrp.CFrame
end
0
Uh god, your script is not FE User#20388 0 — 6y
0
What does FE mean? noammao 294 — 6y
0
@RedcommanderV2 he wanted his script fixed, he never stated he needs it to be FE-compatible. Amiaa16 3227 — 6y
Ad

Answer this question