I’m trying to make my body visible in ROBLOX when in first-person, but my hands are still invisible. HELP! Also this is my first post on the Dev-Forum! YAY! I’m at around a medium scripting level so I might not know some things. Here’s the code:
--initialize variables
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local camera = workspace.CurrentCamera
--camera settings
player.CameraMaxZoomDistance = 0.5 -- force first person
camera.FieldOfView = 100
humanoid.CameraOffset = Vector3.new(0, 0, -1.5)
--changing transparency of body parts
for childIndex, child in pairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
child.LocalTransparencyModifier = 0
end)
end
end
--exception for when player steps in a vehicle
i hope i did this lua thingy right…
It seems to work for other characters, but maybe it’s the robloxian 2.0 character model that’s doing it.
Why check for the property changed signal for LocalTransparencyModifier? You could just do:
local runService = game:GetService("RunService")
runService.RenderStepped:Connect(function()
for childIndex, child in pairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child.LocalTransparencyModifier = 0
end
end
end
also, at the top of your script where you make your variables, I recommend doing this instead (in case your script runs faster than your character loads in):
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
I used render stepped and added some waits. I hope it helps.
--initialize variables
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local camera = workspace.CurrentCamera
--camera settings
player.CameraMaxZoomDistance = 0.5 -- force first person
camera.FieldOfView = 100
humanoid.CameraOffset = Vector3.new(0, 0, -1.5)
game:GetService("RunService").RenderStepped:Connect(function()
for i, child in pairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child.LocalTransparencyModifier = 0
end
end
end)
If you need anything else just dm me or reply to this message