Character's body parts does not show in first person when reset (script shows otherwise before hand)

I made a script where it displays the character’s body via first person. I am aware that it would only appear on one frame, and to avoid using a while loop with task.wait I instead used RunService.RenderStepped.

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local character = localPlayer.CharacterAdded:Wait()

RunService.RenderStepped:Connect(function(deltaTime)
	for _, child in pairs(character:GetChildren()) do
		if child:IsA("BasePart") and child.Name == "Left Arm" or child.Name == "Right Arm" then
			child.LocalTransparencyModifier = child.Transparency
			child.CastShadow = false
		end
	end
end)

The Issue

For some reason, whenever my character respawns/resets, when I go first person mode, I no longer see my arms - why would this happen? I know the runService still worked because I put a print statement there.





P.S: The script is located in StarterPlayerScripts

I tried perhaps putting it into StarterChracacterScripts but for some reason, not a single script I put there every works, can anyone tell me why, or what is it used for, cus, with my understanding, it is a script that reruns every time a new character spawns.


Thank you.

You must have to get the player’s character again because it gets destroyed and the character variable doesn’t hold anything anymore after

local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()

localPlayer.CharacterAdded:Connect(function(_character)
	character = _character
end)

RunService.RenderStepped:Connect(function(deltaTime)
	for _, child in pairs(character:GetChildren()) do
		if child:IsA("BasePart") and child.Name == "Left Arm" or child.Name == "Right Arm" then
			child.LocalTransparencyModifier = child.Transparency
			child.CastShadow = false
		end
	end
end)
1 Like

By any chance, also thank you very much for this, does humanoid also get destroyed when the player resets?

It does get destroyed with the character

1 Like

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