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 players camera and one follow their character?

Asked by 5 years ago

I tried this before, but it doesn't do anything.

One part should be following the players camera (without the parts orientation being affected by camera orientation)

The other part should be on the players feet (without the parts orientation being affected by the characters orientation)

workspace:WaitForChild("Player_Name")

local part = script.Parent.c1winds

local BodyPosition = Instance.new("BodyPosition", part) 
while wait(0) do
    BodyPosition.Position = workspace["Player_Name"].Head.CFrame:pointToWorldSpace(Vector3.new(2, 1, 0))
end

Any solution?

0
uhh i read none of that my head dizzy i eat lot TheluaBanana 946 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

dus dis work for u? Place in StarterPack

local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local part = Instance.new("Part", workspace)
part.Transparency = .75 -- cus its rly annoying to have a part shoved at ur face and u cant see anything
part.Anchored = true
part.CanCollide = false
part.Size = Vector3.new(1,1,1)

local part02 = Instance.new("Part", workspace)
part02.Anchored = true
part02.CanCollide = false
part02.Size = Vector3.new(1,1,1)

player.CharacterAdded:connect(function(char)
    wait() -- wait for root to load
    local root = char:FindFirstChild("HumanoidRootPart")

    game:GetService("RunService").RenderStepped:connect(function()
        part.CFrame = cam.CFrame * CFrame.new(0,0,-part.Size.z)
        part.Orientation = Vector3.new(0,0,0)
        part02.Position = root.Position
    end)
end)
0
it works, but the part that follows the character should stay where its at and not follow the player on the y axis, plus use :Connect(), :connect() is deprecated LoganboyInCO 150 — 5y
0
wait when will :connect be removed? TheluaBanana 946 — 5y
0
ik its deprecated and all but its really nice to type things in lower case TheluaBanana 946 — 5y
0
:connect() will be removed eventually, once people get used to it. LoganboyInCO 150 — 5y
0
lol oof ok TheluaBanana 946 — 5y
Ad

Answer this question