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?

01local Hoova = {"Sergiomontani10", "ClxppaThaDon", "Player1"}
02game.Players.PlayerAdded:Connect(function(newPlayer)
03    local HoovaCMember = Instance.new("BoolValue")
04    HoovaCMember.Name = "HoovaCMember"
05    HoovaCMember.Parent = newPlayer
06    for i,v in pairs(Hoova) do
07        if v == newPlayer.Name then
08            HoovaCMember.Value = true
09        else
10            HoovaCMember.Value = false
11        end
12    end
13end)
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
01local Hoova = {"Sergiomontani10", "ClxppaThaDon", "Player1"}
02game.Players.PlayerAdded:Connect(function(newPlayer)
03    local HoovaCMember = Instance.new("BoolValue")
04    HoovaCMember.Name = "HoovaCMember"
05    HoovaCMember.Value = false
06    HoovaCMember.Parent = newPlayer
07    for i,v in pairs(Hoova) do
08        if v == newPlayer.Name then
09            HoovaCMember.Value = true
10        end
11    end
12end)

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
01local Hoova = {"Sergiomontani10", "ClxppaThaDon", "Player1"}
02game.Players.PlayerAdded:Connect(function(newPlayer)
03    local HoovaCMember = Instance.new("BoolValue")
04    HoovaCMember.Name = "HoovaCMember"
05    HoovaCMember.Parent = newPlayer
06        if not not Hoova[newPlayer.Name] then
07            HoovaCMember = true
08        else
09            HoovaCMember = false
10        end
11end)

Simple

Answer this question