Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this script make the Disabled false?

Asked by 10 years ago

It's just working on a regular script with a Local script inside that's disabled ,but every time the game runs the Local script Disabled property won't turn false,why?

game.Players.PlayerAdded:connect(function(Player)
    Character = Player.CharacterAdded:wait()
    print(Character.Name)
    for Number,LocalScripts in pairs (script:GetChildren()) do
        LocalScripts:Clone().Parent = Character
        LocalScripts.Disabled = false
        print(Player.Name,"now has",LocalScripts)
    end

end)

0
Try adding between lines 4 and 5: 'if LocalScripts:IsA("LocalScript") then', then add another end. TheeDeathCaster 2368 — 10y

1 answer

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Well, you didn't correctly use concatenation and, in my opinion, I would've added another loop because the "LocalScripts" variable doesn't change because it already has a set, permanent value. You'd need to go into the Character to change it.

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Character)
        print(Character.Name)
        for Number,LocalScripts in pairs(script:GetChildren()) do
            LocalScripts:clone().Parent = Character
            for Num,CloneScripts in pairs(Character:GetChildren()) do
                if CloneScripts:IsA("LocalScript") then
                    CloneScripts.Disabled = false
                    print(Player.Name.." now has the Local Scripts.")
                end
            end
        end
    end)
end)
0
Is there another way I can change it without going into the character? kevinnight45 550 — 10y
0
Well, not really. What I did was basically set a variable that goes into the Character. You have to access the character to edit any thing that is its descendant. Shawnyg 4330 — 10y
Ad

Answer this question