local Character = script.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
local Camera = game.Workspace.CurrentCamera
for i, part in pairs(Character:GetChildren()) do
if part:IsA("BasePart") then
part.LocalTransparencyModifier = 0
end
end
game:GetService("RunService").RenderStepped:Connect(function ()
Humanoid.CameraOffset = Vector3.new(0, 0, -0.8)
Camera.FieldOfView = 85
end)
for some reason it doesnt make the parts localTransparency == 0?
when you zoom in the transparency modifier gets changed again, so changing it one time won’t keep it that way forever
put it inside of the loop
or trigger it after the player zooms in if its too inefficient
local Character = script.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
local Camera = game.Workspace.CurrentCamera
game:GetService("RunService").RenderStepped:Connect(function ()
Humanoid.CameraOffset = Vector3.new(0, 0, -0.8)
Camera.FieldOfView = 85
for i, part in pairs(Character:GetChildren()) do
if part:IsA("BasePart") then
part.LocalTransparencyModifier = 0
end
end
end)
Modifying transparency in RenderStepped is often needed due to Roblox changing the values when the camera is close to the head (seems to be the trigger, as I never set cameras to anything other than scriptable or custom).
If you have a lot of parts in your character that you want to modify, or just want something more effecient, you could clone the parts and parent them outside of the character, and then make the parts inside of the character invisibe. That way you can still identify what the character has in it.
Play the game in studio, go to your player’s scripts, and copy the player module. Stop the game, then paste the player module into starter player scripts and do what the original comment said from there
thats what i did, I’ve updated the script since then it still only works like 60% of the time though
local TransparencyController = game.ReplicatedStorage.BasePlayerScripts.TransparencyController
local plr = script.Parent
local PlayerModule = plr:FindFirstChild("PlayerModule")
local CameraModule = PlayerModule:FindFirstChild("CameraModule")
local TransparencyControllerInScript = CameraModule:FindFirstChild("TransparencyController")
if TransparencyControllerInScript then
local TC_Parent = TransparencyControllerInScript.Parent
TransparencyControllerInScript:Destroy()
TransparencyController.Parent = TC_Parent
print(TransparencyController.Parent)
print(TransparencyControllerInScript)
end
prints the correct parent and correct script 100% of the time but for some reason sometimes the players character will still be invisible, can’t figure out why.
I think a more robust method would be to just check whenever the LocalTransparencyModifier gets changed, and to reset it when it does. e.g.:
local IGNORED_BODY_PARTS = {'Head'} -- Change
for _, bodyPart in character:GetChildren() do
if (bodyPart:IsA('BasePart')) and (not table.find(IGNORED_BODY_PARTS, bodyPart.Name)) then
bodyPart:GetPropertyChangedSignal('LocalTransparencyModifier'):Connect(function()
bodyPart.LocalTransparencyModifier = 0
end)
bodyPart.LocalTransparencyModifier = 0
end
end
that would work great but i have a viewmodel and and a local script that makes the left arm and right arm Transparent with the localtransparencymodifier, how could i make this script not effect the others usin localtransparencymodifier
local IGNORED_BODY_PARTS = {'Head'} -- Change
local character = script.Parent
for _, bodyPart in character:GetChildren() do
if (bodyPart:IsA('BasePart')) and (not table.find(IGNORED_BODY_PARTS, bodyPart.Name)) then
bodyPart:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
if character:FindFirstChild("ViewportHands") then
if bodyPart.Name == "Left Arm" or bodyPart.Name == "Right Arm" then
bodyPart.LocalTransparencyModifier = 1
else
bodyPart.LocalTransparencyModifier = 0
end
else
bodyPart.LocalTransparencyModifier = 0
end
end)
bodyPart.LocalTransparencyModifier = 0
end
end