Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this script make the Disabled false?

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)

1 comment

0

Try adding between lines 4 and 5: 'if LocalScripts:IsA("LocalScript") then', then add another end.

1 answer

✓ Accepted answer

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)

2 comments

0

Is there another way I can change it without going into the character?

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.