Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local onVotingBegun = game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("OnVotingBegun")
- local onVotingEnded = game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("OnVotingEnded")
- local onVoteMade = game.ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("OnVoteMade")
- local mapNamesFolder = game.ReplicatedStorage:WaitForChild("ChosenMapNames")
- local mapImagesFolder = game.ReplicatedStorage:WaitForChild("ChosenMapImages")
- local mapVotesFolder = game.ReplicatedStorage:WaitForChild("MapVotes")
- local voteMap1Btn = script.Parent:WaitForChild("VoteMap1")
- local voteMap2Btn = script.Parent:WaitForChild("VoteMap2")
- local voteMap3Btn = script.Parent:WaitForChild("VoteMap3")
- local mapName1 = script.Parent:WaitForChild("MapName1")
- local mapName2 = script.Parent:WaitForChild("MapName2")
- local mapName3 = script.Parent:WaitForChild("MapName3")
- local mapImage1 = script.Parent:WaitForChild("MapImage1")
- local mapImage2 = script.Parent:WaitForChild("MapImage2")
- local mapImage3 = script.Parent:WaitForChild("MapImage3")
- local votesMap1 = script.Parent:WaitForChild("VotesMap1")
- local votesMap2 = script.Parent:WaitForChild("VotesMap2")
- local votesMap3 = script.Parent:WaitForChild("VotesMap3")
- onVotingBegun.OnClientEvent:Connect(function()
- mapName1.Text = mapNamesFolder.Map1Name.Value
- mapName2.Text = mapNamesFolder.Map2Name.Value
- mapName3.Text = mapNamesFolder.Map3Name.Value
- mapImage1.Image = "rbxassetid://" .. mapImagesFolder.Map1Image.Value
- mapImage2.Image = "rbxassetid://" .. mapImagesFolder.Map2Image.Value
- mapImage3.Image = "rbxassetid://" .. mapImagesFolder.Map3Image.Value
- votesMap1.Text = "0"
- votesMap2.Text = "0"
- votesMap3.Text = "0"
- script.Parent.Visible = true
- end)
- onVotingEnded.OnClientEvent:Connect(function()
- script.Parent.Visible = false
- end)
- onVoteMade.OnClientEvent:Connect(function()
- votesMap1.Text = #mapVotesFolder.Map1Votes:GetChildren()
- votesMap2.Text = #mapVotesFolder.Map2Votes:GetChildren()
- votesMap3.Text = #mapVotesFolder.Map3Votes:GetChildren()
- end)
- local function onVoteButtonPressed(mapNum)
- onVoteMade:FireServer(mapNum)
- end
- voteMap1Btn.MouseButton1Click:Connect(function()
- onVoteButtonPressed(1)
- end)
- voteMap2Btn.MouseButton1Click:Connect(function()
- onVoteButtonPressed(2)
- end)
- voteMap3Btn.MouseButton1Click:Connect(function()
- onVoteButtonPressed(3)
- end)
Add Comment
Please, Sign In to add comment