So i got this script that gets the TransparencyController from the player, destroys it, and then replaces it with my modified version. The problem is it only works 10% of the time. Whenever it doesn’t work it still prints all of the scripts but INCLUDING TransparencyController SCRIPT but just doesnt get found in the if statement.
How could i fix this?
local TransparencyController = game.ReplicatedStorage.BasePlayerScripts.TransparencyController
local plr = script.Parent
for i, scriptMod in pairs(plr:WaitForChild("PlayerModule"):WaitForChild("CameraModule"):GetDescendants()) do
print(scriptMod)
if scriptMod.Name == "TransparencyController" then
local Parent = scriptMod.Parent
scriptMod:Destroy()
TransparencyController.Parent = Parent
print("checl")
end
end