Currently I’m using a switch bool to change how I want my LocalTransparencyModifier to be modified.
local doGunTransparency,doCardTransparency = false,false local tool = false for i,v in pairs(c:GetChildren()) do if v:IsA("BasePart") and v.Name ~= "Head" then v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function() if tool == true and doGunTransparency == true or tool == true and doCardTransparency == true or tool == true and doCardTransparency == true and doGunTransparency == true then if v.Name ~= "RightUpperArm" and v.Name ~= "RightLowerArm" and v.Name ~= "RightHand" and v.Name ~= "LeftUpperArm" and v.Name ~= "LeftLowerArm" and v.Name ~= "LeftHand" then if tool == true then v.LocalTransparencyModifier = 0 end else if tool == true then v.LocalTransparencyModifier = 1 else v.LocalTransparencyModifier = 0 end end elseif not tool or not doGunTransparency or not doCardTransparency then v.LocalTransparencyModifier = 0 end end) v.LocalTransparencyModifier = 0 end end
(Ignore the sloppiness, its temporary before I rewrite it.)
variable “c” being the character in this code.
Now the issue is, its fine at first after switching to true and turning off the arms, but after that it just stays arms transparent. I even made sure that it was being set to false and when printing each side of the main if statement it prints as it should, but the transparency doesn’t follow the same “as it should” functionality.
All of this stuff is done over the client with my viewmodel controller sending a BindableEvent remote to toggle the 3 bool variables set in the code above. (Basically what triggers the on and off switch for the arm transparency thing.)
It doesn’t need to be replicated to server because this is a single player game so most stuff can be done on the client with a few exceptions.
Does anyone know why this could be happening? I don’t usually mess with LocalTransparency since I don’t usually need to.
Any input is appreciated.