#probelem with first person animation
1 messages · Page 1 of 1 (latest)
Watch Roblox Studio and millions of other Roblox Studio videos captured using Medal.
heres a video of what happens
i have a script for that that im currently using if you want it, you will have to make adjustments for it to fully work how you want
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
** You are now Level 1! **
btw remove the "if thirdpersonview" and the extra "end" at the bottom
yo ty
Sorry I had hockey practice
I’ll check it out I’m almost home
np :D
Gotcha
only difference
you will want to make
if child:IsA("BasePart") and child.Name ~= "Head" then
add after child.Name ~= "Head"
or child.Name ~= "Torso"
@ruby bear is third person view a value
yea i just have it in my game for debugging purposes
@peak jungle
bool value?
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
Watch Roblox Studio and millions of other Roblox Studio videos captured using Medal.
it still isnt following the head
@ruby bear
yea you have to enable camlock
** You are now Level 2! **
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
yea it lowk does the same thing that was happenign before
so ig ill do some research on how to get around it
are you enabling cam lock in the crouch/slide script?
no just in the regular one
but i cant do it in just the sliding one because the player needs to be able to turn while they are sliding
yea you would need a custom camera for that sorry :c
i tried
why me 