I was working on my game, where there is a voting feature. I want to check weather the player voted so they can't vote again so I created a bool value inside the player through my GM script right here
game.Players.PlayerAdded:Connect(function(player)
local boolValue = Instance.new("BoolValue", player)
boolValue.Name = "voted"
boolValue.Value = false
end)
This works, but what dose not is the detector script. The detector script is a Script inside the voting platforms; the code is below.
local bar = script.Parent.bar1.bar
script.Parent.Touched:Connect(function(plr)
if game.Players.LocalPlayer.voted.Value == false then
bar.Size = bar.Size + Vector3.new(0, 1.44, 0)
game.Workspace.voted.Value = true
end
end)
The console only says that something is wrong at line 4 (if game.Players etc). But when I tried trouble shooting it, nothing changed. I'm really confused and Hope someone can help. Thank you in advance!

5 comments
Hmm, It seems like it should work, but I'm still getting an error. tried tweaking with the script, but that only made it worse.
Also, I was wondering, would this work as the if statement - p, li { white-space: pre-wrap; }
if plr.voted.Value == false thenAnd you are still using game.Players.LocalPlayer in line 5
my bad, fixed it
Yup, Worked! Thank you :D