Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- local VoteRemotes = game.ReplicatedStorage.VoteRemotes
- local VoteValues = game.ReplicatedStorage.VoteValues
- local hasVoted = false
- local VoteFrame = script.Parent
- local function Vote(Button, Option)
- if hasVoted == false then
- hasVoted = true
- Button.Image = "rbxassetid://105874845643806"
- wait(2)
- Button.Image = "rbxassetid://101641611766368"
- VoteRemotes.AddVoteEvent:FireServer(Option)
- end
- end
- -- Toggle Visible
- VoteRemotes.ToggleVoteEvent.OnClientEvent:Connect(function(Value)
- if Value == true then
- VoteFrame.Visible = true
- elseif Value == false then
- VoteFrame.Visible = false
- end
- end)
- VoteFrame.Ending1.Button.MouseButton1Click:Connect(function()
- Vote(VoteFrame.Ending1.Button, 1)
- end)
- VoteFrame.Ending2.Button.MouseButton1Click:Connect(function()
- Vote(VoteFrame.Ending2.Button, 2)
- end)
- VoteFrame.Ending3.Button.MouseButton1Click:Connect(function()
- Vote(VoteFrame.Ending3.Button, 3)
- end)
- VoteFrame.Ending4.Button.MouseButton1Click:Connect(function()
- Vote(VoteFrame.Ending4.Button, 4)
- end)
- -- Update Count --
- VoteValues.Option1.Changed:Connect(function()
- VoteFrame.Ending1.Votes.Text = VoteValues.Option1.Value
- end)
- VoteValues.Option2.Changed:Connect(function()
- VoteFrame.Ending2.Votes.Text = VoteValues.Option2.Value
- end)
- VoteValues.Option3.Changed:Connect(function()
- VoteFrame.Ending3.Votes.Text = VoteValues.Option3.Value
- end)
- VoteValues.Option4.Changed:Connect(function()
- VoteFrame.Ending4.Votes.Text = VoteValues.Option4.Value
- end)
- while wait() do
- VoteFrame.Status.Text = VoteValues.Status.Value
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement