#probelem with first person animation

1 messages · Page 1 of 1 (latest)

peak jungle
#

doesnt lock to the head and it looks weird

#

heres a video of what happens

ruby bear
#

so with this script you also have to have a bool value which gets triggered by other scripts as if you lock it to the head you cant move it

#

-- initialize local variables
local runService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local ThirdPersonView = game.ReplicatedStorage.ThirdPersonView
local CamLock = character.Values.CamLock
local UIS = game:GetService("UserInputService")

local tweenDuration = 0.5

local function tweenCameraOffset(startOffset, endOffset)
    local elapsed = 0
    local connection
    connection = runService.Heartbeat:Connect(function(dt)
        elapsed += dt
        local alpha = math.clamp(elapsed / tweenDuration, 0, 1)
        humanoid.CameraOffset = startOffset:Lerp(endOffset, alpha)
        if alpha >= 1 then
            connection:Disconnect()
        end
    end)
end
#
if ThirdPersonView.Value == false then
    runService.RenderStepped:Connect(function()
        local currentOffset = humanoid.CameraOffset

        if CamLock.Value == true then
            player.CameraMode = Enum.CameraMode.Classic

            camera.CFrame = character.Head.CFrame
            camera.FieldOfView = 100
            humanoid.AutoRotate = false
            tweenCameraOffset(currentOffset, Vector3.new(0, 0, -1))
        else
            player.CameraMode = Enum.CameraMode.LockFirstPerson

            --camera.CFrame = workspace.character.Head.CFrame
            UIS.MouseIconEnabled = false
            camera.FieldOfView = 100
            humanoid.AutoRotate = true
            humanoid.CameraOffset = Vector3.new(0, 0, -1)
            tweenCameraOffset(currentOffset, Vector3.new(0, 0, -1))
        end

    end)    
end 

-- set and keep every body part Transparency to its real transparency
for childIndex, child in pairs(character:GetChildren()) do
    if child:IsA("BasePart") and child.Name ~= "Head" then
    
        child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
            child.LocalTransparencyModifier = child.Transparency
        end)

        child.LocalTransparencyModifier = child.Transparency

    end
end

#

@peak jungle

#

thats the full code

undone driftBOT
#

studio** You are now Level 1! **studio

ruby bear
maiden cradle
#

yo ty

peak jungle
#

I’ll check it out I’m almost home

ruby bear
ruby bear
#

you will want to make

#

if child:IsA("BasePart") and child.Name ~= "Head" then

peak jungle
#

To make torso invisible alright

#

Preciate u man!

peak jungle
#

@ruby bear is third person view a value

ruby bear
#

@peak jungle

peak jungle
#

bool value?

ruby bear
#

yea

#

i put it in replicated storage

#

to enable cam lock btw @peak jungle just state it in the script and turn it to true and when its done turn it to false again

#

the player cannot turn the camera during cam lock tho

#

which is

#

the only disadvantage

#

but it cant be worked around'

#

from what i know

peak jungle
#

it still isnt following the head

#

@ruby bear

ruby bear
undone driftBOT
#

studio** You are now Level 2! **studio

ruby bear
#

in the script

#

and disable it

#

in your sliding/crouched

#

script

#

the only other thing you could do is have an entirely custom camera

#

but thats alot harder to do

#

which i unfortunatly cannot help with

#

as i have limited scripting experience myself

peak jungle
#

yea it lowk does the same thing that was happenign before

#

so ig ill do some research on how to get around it

ruby bear
peak jungle
peak jungle
#

but i cant do it in just the sliding one because the player needs to be able to turn while they are sliding

ruby bear
#

i tried

peak jungle
#

its alr

#

@brazen jackal i summon u

#

unless u dont wanna be summoned

brazen jackal