Map Voting System

Hello I’ve got a Voting System for a current game everything works but I was hoping to make it so when a player buys a gamepass (2X VOTING) it makes the players votes count as 2 instead of 1

What line of coding would be added to go about this and make it work?

Script:

local VoteState2 = game.Lighting.Votes:FindFirstChild(VoteState) 
if VoteState2 then
	if State == "Add" then
		VoteState2.Value = VoteState2.Value + 1
	elseif State == "Sub" then
		if VoteState2.Value <= 0 then
			else
		VoteState2.Value = VoteState2.Value - 1
		end
	end
end
end
game.ReplicatedStorage.Vote.OnServerEvent:connect(onwin)

Can you please put the script in the correct format.

function onwin(player,VoteState,State)
local VoteState2 = game.Lighting.Votes:FindFirstChild(VoteState)
if VoteState2 then
if State == “Add” then
VoteState2.Value = VoteState2.Value + 1
elseif State == “Sub” then
if VoteState2.Value <= 0 then
else
VoteState2.Value = VoteState2.Value - 1
end
end
end
end
game.ReplicatedStorage.Vote.OnServerEvent:connect(onwin)

This ought to get the job done.

local MarketplaceService = game:GetService("MarketplaceService")
local Id = 00000 -- Put the game pass ID here.

function onwin(player,VoteState,State)
local VoteState2 = game.Lighting.Votes:FindFirstChild(VoteState)

if VoteState2 then
local Count= MarketplaceService:UserOwnsGamePassAsync(Player.UserId,Id) and 2 or 1

if State == “Add” then
VoteState2.Value = VoteState2.Value + Count
elseif State == “Sub” then
if VoteState2.Value <= 0 then
else
VoteState2.Value = VoteState2.Value - Count
end
end
end
end

game.ReplicatedStorage.Vote.OnServerEvent:connect(onwin)
3 Likes