Make camera follow head in first person with accessories invisible

I’m sorry I was sleeping since I wasn’t feeling so well. I’ll try it out now.

It works though it gives this error: Transparency is not a valid member of Configuration “Workspace.kolmatinsweden.AnimeShortHairAccessory10.ThumbnailConfiguration”

I fixed the error though it doesn’t follow the head all of the time. I have a running animation in which you can see a bit of the back of the head.

my code:

local runService = game:GetService("RunService")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local currentCamera = game.Workspace.CurrentCamera

wait(2)
for _, child in pairs(character:GetDescendants()) do
	if child:IsA("Accessory") then
		for _, accessory in pairs(child:GetChildren()) do
			for _, part in pairs(child:GetChildren()) do
				if not part:IsA("Configuration") then
					part.Transparency = 1
				end
			end
		end
	end
end

currentCamera.CameraSubject = character:WaitForChild("Head")
player.CameraMinZoomDistance = 0.5
player.CameraMaxZoomDistance = 0.5

runService.RenderStepped:Connect(function()
	local x1, y1, z1 = currentCamera.CFrame:ToOrientation()
	local x2, y2, z2 = character.PrimaryPart.CFrame:ToOrientation()
	character.PrimaryPart.CFrame *= CFrame.Angles(0, y1 - y2, 0)
end)

This should go into community resources.

1 Like

No, since it started as me needing help.

1 Like

Well, animation is animation, its not head actually moving
you can make head invisible, that will fix it abit.

New script

local runService = game:GetService("RunService")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local currentCamera = game.Workspace.CurrentCamera

wait(2)
for _, child in pairs(character:GetDescendants()) do
	if child:IsA("Accessory") then
		for _, accessory in pairs(child:GetChildren()) do
			if accessory:IsA("MeshPart") then
				accessory.Transparency = 1
			end
		end
	elseif child.Name == "Head" and child:IsA("MeshPart") then
		child.Transparency = 1
	end
end

currentCamera.CameraSubject = character:WaitForChild("Head")
player.CameraMinZoomDistance = 0
player.CameraMaxZoomDistance = 0

runService.RenderStepped:Connect(function()
	local x1, y1, z1 = currentCamera.CFrame:ToOrientation()
	local x2, y2, z2 = character.PrimaryPart.CFrame:ToOrientation()
	character.PrimaryPart.CFrame *= CFrame.Angles(0, y1 - y2, 0)
end)

I will rework it once more so that your camera will actually be a bit in front, so you wont see the top of your head, and add a neck movement (maybe also a function that while you hold, lets say left alt key, you will be able to move your mouse on the screen).

1 Like

Good Idea, I’ll make it as community resource later

I made a new script for it, now It fixes that problems, but only works with R15 type for now. for more info check: First Person Mode [V1.0]

Sad, my game is in r6 not r15.

Im working on a fix for this, stay tuned.

What!??!? Are you sure? This is a lot of work for a stranger on the internet! :open_mouth:

Lol, I like the idea to have a first person mode, also, I’m almost done with coding it so that it would work with R6 too.

Put it in community resources too would probably help a lot of people and not just me :sweat_smile:

I did already, I will update it in a minute, you can find it here

1 Like

Alright, just reply when it’s done :smiley:

Its finally updated and out. Now it works both with R15 and R6. Go check it out:

3 Likes

Thank you!!! You really are a legend.

though one little bug: Infinite yield possible on ‘Players.kolmatinsweden.PlayerGui:WaitForChild(“FirstPerson”)’

oh wait nvm turns out i put it in a wrong place :sweat_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.