game.Players.LocalPlayer.CharacterAdded:Connect(function(z)
for i,v in pairs(z:GetChildren()) do
if v.Name ~= "Head" and v:IsA("BasePart")or v:IsA("MeshPart")then
v.LocalTransparencyModifier= 0
if v.LocalTransparencyModifier == 0 then
print("Success")
end
end
end
end)
this is my script also didn’t print “Success”
-A localScript in the StarterCharacterScripts
The issue might be because the character loaded before .CharacterAdded event loaded, meaning it wouldn’t load. Try checking if the player already exists.
local Player = game.Players.LocalPlayer
if Player.Character then
-- code here
end
local Player = game.Players.LocalPlayer
if Player.Character then
Player.CharacterAdded:Connect(function(a)
for i,v in pairs(a:GetChildren()) do
if v.Name ~= "Head" and v:IsA("BasePart")or v:IsA("MeshPart")then
v.LocalTransparencyModifier= 0
if v.LocalTransparencyModifier == 0 then
print("Sucess")
end
end
end
end)
end
Wait, try this script instead. I would recommend checking for these three things when changing the character part’s LocalTransparencyModifier:
If the player has already loaded
The CharacterAdded event, just incase the player hasn’t loaded
If something gets added to the player
local Player = game.Players.LocalPlayer
local function FirstPerson(a)
for i,v in pairs(a:GetChildren()) do
if v.Name ~= "Head" and v:IsA("BasePart") or v:IsA("MeshPart") then
v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
v.LocalTransparencyModifier = 0
if v.LocalTransparencyModifier == 0 then
print("Sucess")
end
end)
end
end
end
Player.CharacterAdded:Connect(function(a)
FirstPerson(a)
end)
if Player.Character then
FirstPerson(Player.Character)
Player.Character.ChildAdded:Connect(function()
FirstPerson(Player.Character)
end)
end