I was trying to make a vote system that was awesome and ran into a usual problem. “Attempt to index nil wait “WaitForChild””
This is part of my code, this is the part giving an error.
Dmap1.Touched:Connect(function(hit)
if hit then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr:WaitForChild("Voted").Value ~= Cmap1.Name and plr:WaitForChild("Voted") ~= nil then -- error
plr:WaitForChild("Voted").Value = Cmap1.Name
v1.Value += 1
if v2.Value > 0 then
v2.Value -= 1
elseif v3.Value > 0 then
v3.Value -= 1
end
end
end
end)
Help appreicated!