Hello developers,
I have ran into another problem. (yay)
Now my problem happened when I was trying to make a voting system and I was working on the client. I’ve tested and I think I found what the error is, but not how to solve it. When counting votes I add them to a value, and then when the round is over I reset the value to 0
but when I check the value on the Server it keeps adding AFTER I reset it. But the weird part is when I vote for a new map the value just moves.
↓ Watch the video to understand what I mean
You see in the video that the value doesn’t change, and just keeps adding.
Code
No script error is in the output
This code is a part of a while true do
loop. Now some of you may be asking is this a server script? Yes, the script I am clearing it on is a server script.
OfficeVote.Value = 0 -- Suppost to clear the value
PodcastVote.Value = 0
CrossroadsVote.Value = 0
print("Office Votes: "..OfficeVote.Value.." Podcast Votes: "..PodcastVote.Value.." Crossroads Votes: "..CrossroadsVote.Value)
Later down the code…
Now in this part, I add the votes.
VoteEvent.OnServerEvent:Connect(function(Player, MapVote)
if CanVote == true then
if MapVote == "Office" then
OfficeVote.Value += 1
elseif MapVote == "Podcast" then
PodcastVote.Value += 1
elseif MapVote == "Crossroads" then
CrossroadsVote.Value += 1
end
end
ReplicatedStorage.Main.Voting.VotedEvent:FireAllClients(MapVote, OfficeVote, PodcastVote, CrossroadsVote, Player)
end)