About
This is my simplest first person mode I made.
It makes you go into the first person, putting your camera on the head and making accessories
invisible. Accessories of the player will be invisible only to him, other players will be able to see them. Also script takes 2 seconds to load.
How to make it work
To make it work, create a localscript (for example FirstPersonMode) in a game.StarterPlayer.StarterCharacterScripts and put in this script.
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
accessory.Transparency = 1
end
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)
If you want you can also just take my model here:
and you can leave a comment what you think about it.
If you have any other questions, feel free to ask.
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)
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).