when a player joins the game the game inserts a folder with a bool value: "hasvoted",
game.Players.PlayerAdded:connect(function(player)
local settings = Instance.new("Folder",player)
settings.Name = "Settings"
local afk = Instance.new("BoolValue",settings)
afk.Name = "hasvoted"
end)
now, whenever a player touches a part (to vote) how to I access this to check if he has or has not? this is my code so far, but it does not work:
script.Parent.Touched:connect(function(p)
if game.Players:GetPlayerFromCharacter(p.Parent) then
local player = game.Players:GetPlayerFromCharacter(p.Parent)
if player.Settings.hasvoted == false then
print("Player Voted.")
elseif player.Settings.hasvoted == true then
reply.Text = "You have already voted for an event!"
end
end
end)

1 comment
I got some of this code from a vip door, so that's why its like that