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

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

Asked by 6 years ago

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)
1
That doesn't make any sense, v is a string. theCJarmy7 1293 — 6y
0
That won't work the string does have the property ".Name". are you using a localscript or a script? yyyyyy09 246 — 6y
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. TiredMelon 405 — 6y
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. TiredMelon 405 — 6y

2 answers

Log in to vote
1
Answered by
waifuSZN 123
6 years ago
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.

0
basically, what yyyyy said. waifuSZN 123 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
    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

Answer this question