Advertisement
saturnsolar

Stuff LocalScript (Map Voting GUI) | ROBLOX Studio

Apr 24th, 2020
8,089
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.75 KB | None | 0 0
  1. local player = game:GetService("Players").LocalPlayer
  2. local voted = player:WaitForChild("voted")
  3. local rep = game:GetService("ReplicatedStorage")
  4. local votere = rep:WaitForChild("RemoteEvent"):WaitForChild("Vote")
  5. local variables = rep:WaitForChild("Variables")
  6. local boolean = rep:WaitForChild("Booleans"):WaitForChild("RevealVotes")
  7. local choice = variables:WaitForChild("Choice1")
  8. local votechoice = variables:WaitForChild("VoteChoice1")
  9. local votescounter = script.Parent:FindFirstChild("Votes")
  10.  
  11. local map = choice.Value
  12.     if choice.Value then
  13.     script.Parent.Title.Text = map.Name
  14.     end
  15. choice:GetPropertyChangedSignal("Value"):Connect(function()
  16.     local map = choice.Value
  17.         if choice.Value then
  18.         script.Parent.Title.Text = map.Name
  19.         end
  20. end)
  21.  
  22. if voted.Value == true then
  23.     script.Parent.VOTE.Visible = false
  24. else
  25.     script.Parent.VOTE.Visible = true
  26. end
  27.  
  28. voted:GetPropertyChangedSignal("Value"):Connect(function()
  29.     if voted.Value == true then
  30.         script.Parent.VOTE.Visible = false
  31.     else
  32.         script.Parent.VOTE.Visible = true
  33.     end
  34. end)
  35.  
  36. script.Parent.VOTE.MouseButton1Click:Connect(function()
  37.     votere:FireServer(choice.Name)
  38. end)
  39.  
  40. if boolean.Value == true then
  41.     votescounter.Visible = true
  42.     for i = 1,20 do
  43.         votescounter.Text = "Votes: "..math.random(0,10)
  44.         wait()
  45.     end
  46.     votescounter.Text = "Votes: "..votechoice.Value
  47. else
  48.     votescounter.Visible = false
  49.     votescounter.Text = "Votes: "
  50. end
  51.  
  52. boolean:GetPropertyChangedSignal("Value"):Connect(function()
  53.     if boolean.Value == true then
  54.         votescounter.Visible = true
  55.         for i = 1,20 do
  56.             votescounter.Text = "Votes: "..math.random(0,10)
  57.             wait()
  58.     end
  59.         votescounter.Text = "Votes: "..votechoice.Value
  60.     else
  61.         votescounter.Visible = false
  62.         votescounter.Text = "Votes: "
  63.     end
  64. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement