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

How would you make the camera also rotate the character?

Asked by 9 years ago

The problem:

I am trying to figure out how to make a MouseLock style 3rd Person camera, but I cannot make the character move with camera.

The code:

local p = game.Players.LocalPlayer
p.CharacterAdded:wait()
local char = p.Character
char.Humanoid.CameraOffset = Vector3.new(1.5, 0.5, 0.5)

What would I need to change/add to make it work?

NOTE: This is in a LocalScript, inside StarterPack.

Thank you :)

1 answer

Log in to vote
1
Answered by 9 years ago

Okay, I've rewritten it:

Try using this:

self = script.Parent
c = workspace.CurrentCamera

player = game.Players.LocalPlayer
char = player.Character or player.CharacterAdded:wait()
humanoid = char:WaitForChild("Humanoid")

-- Apply some properties

player.CameraMaxZoomDistance = 400
player.CameraMinZoomDistance = .5
humanoid.CameraOffset = Vector3.new(1.5,.5,.5)

function lock(part)
    if part and part:IsA("BasePart") then
        part.LocalTransparencyModifier = part.Transparency
        part.Changed:connect(function (property)
            part.LocalTransparencyModifier = part.Transparency
        end)
    end
end

for _,v in pairs(char:GetChildren()) do
    lock(v)
end

char.ChildAdded:connect(lock)



char.ChildAdded:connect(lock)

I hope it works!

0
It's working, but it only works for back and forwards, and it's in the opposite direction of the camera (facing forward, character facing back) TheDeadlyPanther 2460 — 9y
0
ah, okay, I have no idea why, I'll test it myself, and try to fix it, I'll edit it once I finish it Quil_Cyndaquil 26 — 9y
0
ty TheDeadlyPanther 2460 — 9y
0
Okay, I've fixed it Quil_Cyndaquil 26 — 9y
0
This still doesn't really do what I wanted it to.. But I'll accept your answer. TheDeadlyPanther 2460 — 9y
Ad

Answer this question