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

This will not set the value for the new player. Any help?

For some odd reason this script isnt working. The game is Filtering Enabled.

If your name is in the table it is suppose to set your value to true but it won't.

Any Fixes?

local Hoova = {"Sergiomontani10", "ClxppaThaDon", "Player1"}
game.Players.PlayerAdded:Connect(function(newPlayer) 
    local HoovaCMember = Instance.new("BoolValue")
    HoovaCMember.Name = "HoovaCMember" 
    HoovaCMember.Parent = newPlayer
    for i,v in pairs(Hoova) do
        if v == newPlayer.Name then
            HoovaCMember.Value = true
        else
            HoovaCMember.Value = false
        end
    end
end)

4 comments

1

That doesn't make any sense, v is a string.

0

That won't work the string does have the property ".Name". are you using a localscript or a script?

0

You dont need the else statement. The else statement turns off the value since the player is not equal to every single person in there.

0

I have no idea what you mean v being a string, the .Name is also the string, script is fine just needed to remove the else statement. I tested it out.

2 answers

✓ Accepted answer
local Hoova = {"Sergiomontani10", "ClxppaThaDon", "Player1"}
game.Players.PlayerAdded:Connect(function(newPlayer) 
    local HoovaCMember = Instance.new("BoolValue")
    HoovaCMember.Name = "HoovaCMember" 
	HoovaCMember.Value = false
    HoovaCMember.Parent = newPlayer
    for i,v in pairs(Hoova) do
        if v == newPlayer.Name then
            HoovaCMember.Value = true
		end
    end
end)

The else loop isn't necessary; in fact, it resets your BoolValue through every iteration.

Instead, remove the else condition and simply default your bool to false until a condition is met that it will be true.

1 comment

0

basically, what yyyyy said.

	local Hoova = {"Sergiomontani10", "ClxppaThaDon", "Player1"}
	game.Players.PlayerAdded:Connect(function(newPlayer)
	    local HoovaCMember = Instance.new("BoolValue")
	    HoovaCMember.Name = "HoovaCMember"
	    HoovaCMember.Parent = newPlayer
	    	if not not Hoova[newPlayer.Name] then
				HoovaCMember = true
			else
				HoovaCMember = false
	    	end
	end)

Simple

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