Making body visible in first person mode

Hi,

The game i’m making is entirely in first person view. I want to make it so the player can still see his own body whilst still in first person when he looks down etc, and see his arms moving. Whats the best way to go about doing this?

Thanks.

1 Like

Games like “Evade” and “Untilted Tag” game is the style i’m going for

something like this should do the trick,

local player = game.Players.LocalPlayer
local char = player.Character
local RunService = game:GetService("RunService")

char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)

for i, v in pairs(char:GetChildren()) do
	if v:IsA("BasePart") and v.Name ~= "Head" then

		v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
			v.LocalTransparencyModifier = v.Transparency
		end)

		v.LocalTransparencyModifier = v.Transparency

	end
end

RunService.RenderStepped:Connect(function(step)
	local ray = Ray.new(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit)
	local ignoreList = char:GetChildren()

	local hit, pos = game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)

	if hit then
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - pos).magnitude)
	else
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
	end
end)

Hope this gets a solution

1 Like

i literally have a script in my game that does this:

local players = game:GetService("Players")
local plr = players.LocalPlayer
local runService = game:GetService("RunService")
local camera = workspace.CurrentCamera


runService:BindToRenderStep("Camera", 1000000, function()
	local char = plr.Character or plr.CharacterAdded:Wait()
	local humanoid = char:WaitForChild("Humanoid")
	humanoid.CameraOffset = Vector3.new(0,0,-0.5) -- u can mess with this until you get an effect you like
	
	if char then
		local tab = {'Left Arm','Right Arm','LeftUpperArm','LeftLowerArm','RightUpperArm','RightLowerArm','RightHand','LeftHand'} -- table of parts that are NOT visable
		for i,limb in pairs(char:GetChildren()) do
			if limb and limb:IsA("BasePart") then
				if table.find(tab,limb.Name) then
					limb.Transparency = 0
					limb.LocalTransparencyModifier = 0
				end
			end
		end
	end
end)

just shove this into StarterPlayerScripts and it should do the job (works with both R6 and R15)

Quick tip:

workspace:FindPartOnRayWitchIgnoreList() is deprecated, just use normal workspace:Raycast().

Heres a modified version:

local player = game.Players.LocalPlayer
local char = player.Character
local RunService = game:GetService("RunService")

char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)

for i, v in pairs(char:GetChildren()) do
	if v:IsA("BasePart") and v.Name ~= "Head" then

		v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
			v.LocalTransparencyModifier = v.Transparency
		end)

		v.LocalTransparencyModifier = v.Transparency

	end
end

RunService.RenderStepped:Connect(function(step)
	local params = RaycastParams.new()
	params.FilterType = Enum.RaycastFilterType.Exclude
	params.FilterDescendantsInstances = {char}
	
	local ray = workspace:Raycast(char.Head.Position, ((char.Head.CFrame + char.Head.CFrame.LookVector * 2) - char.Head.Position).Position.Unit, params)
	local ignoreList = char:GetChildren()

	if ray then
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -(char.Head.Position - ray.Position).magnitude)
	else
		char.Humanoid.CameraOffset = Vector3.new(0, 0, -1)
	end
end)

(this version also feels smoother in my opinion)

ive been using findpartonraywitchignorelist my entire time on roblox lol. thx ima change that.

1 Like

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