BobMe

poll

Jun 29th, 2020 (edited)
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.87 KB | None | 0 0
  1. -- GUIS:
  2. -- Vote results
  3.  
  4. local VoteResults = Instance.new("ScreenGui")
  5. local Frame = Instance.new("Frame")
  6. local Top = Instance.new("TextLabel")
  7. local TextButton = Instance.new("TextButton")
  8. local Question = Instance.new("TextLabel")
  9. local AnswerGreen = Instance.new("Frame")
  10. local AnswerName = Instance.new("TextLabel")
  11. local AnswerAmount = Instance.new("TextLabel")
  12. local AnswerGrey = Instance.new("Frame")
  13. local AnswerName_2 = Instance.new("TextLabel")
  14. local AnswerAmount_2 = Instance.new("TextLabel")
  15. local AnswerRed = Instance.new("Frame")
  16. local AnswerName_3 = Instance.new("TextLabel")
  17. local AnswerAmount_3 = Instance.new("TextLabel")
  18.  
  19. -- Properties
  20.  
  21. VoteResults.Name = "Vote Results"
  22. VoteResults.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  23.  
  24. Frame.Parent = VoteResults
  25. Frame.AnchorPoint = Vector2.new(0.5, 0.5)
  26. Frame.BackgroundColor3 = Color3.new(0, 0, 0)
  27. Frame.BackgroundTransparency = 0.5
  28. Frame.Position = UDim2.new(0.5, 0, -0.25, 0)
  29. Frame.Size = UDim2.new(0.400000006, 0, 0.400000006, 0)
  30.  
  31. Top.Name = "Top"
  32. Top.Parent = Frame
  33. Top.BackgroundColor3 = Color3.new(0, 0, 0)
  34. Top.BackgroundTransparency = 0.5
  35. Top.Size = UDim2.new(1, 0, 0.0799999982, 0)
  36. Top.Font = Enum.Font.SourceSans
  37. Top.Text = "Poll results"
  38. Top.TextColor3 = Color3.new(1, 1, 1)
  39. Top.TextScaled = true
  40. Top.TextSize = 14
  41. Top.TextWrapped = true
  42. Top.TextXAlignment = Enum.TextXAlignment.Left
  43.  
  44. TextButton.Parent = Top
  45. TextButton.AnchorPoint = Vector2.new(1, 0)
  46. TextButton.BackgroundColor3 = Color3.new(1, 1, 1)
  47. TextButton.BackgroundTransparency = 1
  48. TextButton.Position = UDim2.new(1, 0, 0, 0)
  49. TextButton.Size = UDim2.new(1, 0, 1, 0)
  50. TextButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
  51. TextButton.Font = Enum.Font.SourceSans
  52. TextButton.Text = "X"
  53. TextButton.TextColor3 = Color3.new(1, 1, 1)
  54. TextButton.TextScaled = true
  55. TextButton.TextSize = 14
  56. TextButton.TextWrapped = true
  57.  
  58. Question.Name = "Question"
  59. Question.Parent = Frame
  60. Question.BackgroundColor3 = Color3.new(1, 1, 1)
  61. Question.BackgroundTransparency = 0.80000001192093
  62. Question.Position = UDim2.new(0, 0, 0.0799999982, 0)
  63. Question.Size = UDim2.new(1, 0, 0.319999993, 0)
  64. Question.Font = Enum.Font.SourceSans
  65. Question.Text = "Question: Should I respawn every player?"
  66. Question.TextColor3 = Color3.new(1, 1, 1)
  67. Question.TextScaled = true
  68. Question.TextSize = 14
  69. Question.TextWrapped = true
  70. Question.TextXAlignment = Enum.TextXAlignment.Left
  71. Question.TextYAlignment = Enum.TextYAlignment.Top
  72.  
  73. AnswerGreen.Name = "AnswerGreen"
  74. AnswerGreen.Parent = Frame
  75. AnswerGreen.BackgroundColor3 = Color3.new(0.00392157, 0.364706, 0)
  76. AnswerGreen.BackgroundTransparency = 0.5
  77. AnswerGreen.BorderSizePixel = 0
  78. AnswerGreen.Position = UDim2.new(0.100000001, 0, 0.5, 0)
  79. AnswerGreen.Size = UDim2.new(0.25, 0, 0.400000006, 0)
  80.  
  81. AnswerName.Name = "AnswerName"
  82. AnswerName.Parent = AnswerGreen
  83. AnswerName.AnchorPoint = Vector2.new(0, 1)
  84. AnswerName.BackgroundColor3 = Color3.new(0, 0, 0)
  85. AnswerName.BackgroundTransparency = 0.80000001192093
  86. AnswerName.Position = UDim2.new(0, 0, 1, 0)
  87. AnswerName.Size = UDim2.new(1, 0, 0.5, 0)
  88. AnswerName.Font = Enum.Font.SourceSans
  89. AnswerName.Text = "Yes"
  90. AnswerName.TextColor3 = Color3.new(0, 1, 0.0313726)
  91. AnswerName.TextScaled = true
  92. AnswerName.TextSize = 14
  93. AnswerName.TextWrapped = true
  94. AnswerName.TextYAlignment = Enum.TextYAlignment.Top
  95.  
  96. AnswerAmount.Name = "AnswerAmount"
  97. AnswerAmount.Parent = AnswerGreen
  98. AnswerAmount.BackgroundColor3 = Color3.new(0, 0, 0)
  99. AnswerAmount.BackgroundTransparency = 1
  100. AnswerAmount.Size = UDim2.new(1, 0, 0.5, 0)
  101. AnswerAmount.Font = Enum.Font.SourceSans
  102. AnswerAmount.Text = "5"
  103. AnswerAmount.TextColor3 = Color3.new(1, 1, 1)
  104. AnswerAmount.TextScaled = true
  105. AnswerAmount.TextSize = 14
  106. AnswerAmount.TextWrapped = true
  107. AnswerAmount.TextYAlignment = Enum.TextYAlignment.Top
  108.  
  109. AnswerGrey.Name = "AnswerGrey"
  110. AnswerGrey.Parent = Frame
  111. AnswerGrey.AnchorPoint = Vector2.new(0.5, 0)
  112. AnswerGrey.BackgroundColor3 = Color3.new(0.364706, 0.364706, 0.364706)
  113. AnswerGrey.BackgroundTransparency = 0.5
  114. AnswerGrey.BorderSizePixel = 0
  115. AnswerGrey.Position = UDim2.new(0.5, 0, 0.5, 0)
  116. AnswerGrey.Size = UDim2.new(0.25, 0, 0.400000006, 0)
  117.  
  118. AnswerName_2.Name = "AnswerName"
  119. AnswerName_2.Parent = AnswerGrey
  120. AnswerName_2.AnchorPoint = Vector2.new(0, 1)
  121. AnswerName_2.BackgroundColor3 = Color3.new(0, 0, 0)
  122. AnswerName_2.BackgroundTransparency = 0.80000001192093
  123. AnswerName_2.Position = UDim2.new(0, 0, 1, 0)
  124. AnswerName_2.Size = UDim2.new(1, 0, 0.5, 0)
  125. AnswerName_2.Font = Enum.Font.SourceSans
  126. AnswerName_2.Text = "NoA"
  127. AnswerName_2.TextColor3 = Color3.new(1, 1, 1)
  128. AnswerName_2.TextScaled = true
  129. AnswerName_2.TextSize = 14
  130. AnswerName_2.TextWrapped = true
  131. AnswerName_2.TextYAlignment = Enum.TextYAlignment.Top
  132.  
  133. AnswerAmount_2.Name = "AnswerAmount"
  134. AnswerAmount_2.Parent = AnswerGrey
  135. AnswerAmount_2.BackgroundColor3 = Color3.new(0, 0, 0)
  136. AnswerAmount_2.BackgroundTransparency = 1
  137. AnswerAmount_2.Size = UDim2.new(1, 0, 0.5, 0)
  138. AnswerAmount_2.Font = Enum.Font.SourceSans
  139. AnswerAmount_2.Text = "5"
  140. AnswerAmount_2.TextColor3 = Color3.new(1, 1, 1)
  141. AnswerAmount_2.TextScaled = true
  142. AnswerAmount_2.TextSize = 14
  143. AnswerAmount_2.TextWrapped = true
  144. AnswerAmount_2.TextYAlignment = Enum.TextYAlignment.Top
  145.  
  146. AnswerRed.Name = "AnswerRed"
  147. AnswerRed.Parent = Frame
  148. AnswerRed.AnchorPoint = Vector2.new(1, 0)
  149. AnswerRed.BackgroundColor3 = Color3.new(0.364706, 0, 0)
  150. AnswerRed.BackgroundTransparency = 0.5
  151. AnswerRed.BorderSizePixel = 0
  152. AnswerRed.Position = UDim2.new(0.899999976, 0, 0.5, 0)
  153. AnswerRed.Size = UDim2.new(0.25, 0, 0.400000006, 0)
  154.  
  155. AnswerName_3.Name = "AnswerName"
  156. AnswerName_3.Parent = AnswerRed
  157. AnswerName_3.AnchorPoint = Vector2.new(0, 1)
  158. AnswerName_3.BackgroundColor3 = Color3.new(0, 0, 0)
  159. AnswerName_3.BackgroundTransparency = 0.80000001192093
  160. AnswerName_3.Position = UDim2.new(0, 0, 1, 0)
  161. AnswerName_3.Size = UDim2.new(1, 0, 0.5, 0)
  162. AnswerName_3.Font = Enum.Font.SourceSans
  163. AnswerName_3.Text = "N/A"
  164. AnswerName_3.TextColor3 = Color3.new(1, 0, 0)
  165. AnswerName_3.TextScaled = true
  166. AnswerName_3.TextSize = 14
  167. AnswerName_3.TextWrapped = true
  168. AnswerName_3.TextYAlignment = Enum.TextYAlignment.Top
  169.  
  170. AnswerAmount_3.Name = "AnswerAmount"
  171. AnswerAmount_3.Parent = AnswerRed
  172. AnswerAmount_3.BackgroundColor3 = Color3.new(0, 0, 0)
  173. AnswerAmount_3.BackgroundTransparency = 1
  174. AnswerAmount_3.Size = UDim2.new(1, 0, 0.5, 0)
  175. AnswerAmount_3.Font = Enum.Font.SourceSans
  176. AnswerAmount_3.Text = "5"
  177. AnswerAmount_3.TextColor3 = Color3.new(1, 1, 1)
  178. AnswerAmount_3.TextScaled = true
  179. AnswerAmount_3.TextSize = 14
  180. AnswerAmount_3.TextWrapped = true
  181. AnswerAmount_3.TextYAlignment = Enum.TextYAlignment.Top
  182.  
  183. -- Vote
  184.  
  185. local Vote = Instance.new("ScreenGui")
  186. local Frame = Instance.new("Frame")
  187. local Question = Instance.new("TextLabel")
  188. local Yes = Instance.new("TextButton")
  189. local No = Instance.new("TextButton")
  190. local Time = Instance.new("TextLabel")
  191. local Top = Instance.new("TextLabel")
  192. local TextButton = Instance.new("TextButton")
  193.  
  194. -- Properties
  195.  
  196. Vote.Name = "Vote"
  197. Vote.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  198.  
  199. Frame.Parent = Vote
  200. Frame.AnchorPoint = Vector2.new(1, 1)
  201. Frame.BackgroundColor3 = Color3.new(0, 0, 0)
  202. Frame.BackgroundTransparency = 0.5
  203. Frame.Position = UDim2.new(1.35, -10, 1, -10)
  204. Frame.Size = UDim2.new(0.2, 0, 0.12, 0)
  205.  
  206. Question.Name = "Question"
  207. Question.Parent = Frame
  208. Question.BackgroundColor3 = Color3.new(1, 1, 1)
  209. Question.BackgroundTransparency = 1
  210. Question.Position = UDim2.new(0, 0, 0.150000006, 0)
  211. Question.Size = UDim2.new(1, 0, 0.550000012, 0)
  212. Question.Font = Enum.Font.SourceSans
  213. Question.Text = "Should I respawn every player?"
  214. Question.TextColor3 = Color3.new(1, 1, 1)
  215. Question.TextScaled = true
  216. Question.TextSize = 14
  217. Question.TextWrapped = true
  218.  
  219. Yes.Name = "Yes"
  220. Yes.Parent = Frame
  221. Yes.AnchorPoint = Vector2.new(1, 0.5)
  222. Yes.BackgroundColor3 = Color3.new(0, 0.8, 0.0666667)
  223. Yes.BorderSizePixel = 0
  224. Yes.Position = UDim2.new(0.449999988, 0, 0.850000024, 0)
  225. Yes.Size = UDim2.new(0.300000012, 0, 0.200000003, 0)
  226. Yes.Font = Enum.Font.SourceSans
  227. Yes.Text = "Yes"
  228. Yes.TextColor3 = Color3.new(1, 1, 1)
  229. Yes.TextScaled = true
  230. Yes.TextSize = 14
  231. Yes.TextWrapped = true
  232.  
  233. No.Name = "No"
  234. No.Parent = Frame
  235. No.AnchorPoint = Vector2.new(0, 0.5)
  236. No.BackgroundColor3 = Color3.new(0.8, 0, 0.0117647)
  237. No.BorderSizePixel = 0
  238. No.Position = UDim2.new(0.550000012, 0, 0.850000024, 0)
  239. No.Size = UDim2.new(0.300000012, 0, 0.200000003, 0)
  240. No.Font = Enum.Font.SourceSans
  241. No.Text = "No"
  242. No.TextColor3 = Color3.new(1, 1, 1)
  243. No.TextScaled = true
  244. No.TextSize = 14
  245. No.TextWrapped = true
  246.  
  247. Time.Name = "Time"
  248. Time.Parent = Frame
  249. Time.AnchorPoint = Vector2.new(1, 1)
  250. Time.BackgroundColor3 = Color3.new(1, 1, 1)
  251. Time.BackgroundTransparency = 1
  252. Time.Position = UDim2.new(1, 0, 1, -2)
  253. Time.Size = UDim2.new(0.25, 0, 0.25, 0)
  254. Time.SizeConstraint = Enum.SizeConstraint.RelativeYY
  255. Time.Font = Enum.Font.SourceSans
  256. Time.Text = "10"
  257. Time.TextColor3 = Color3.new(1, 1, 1)
  258. Time.TextScaled = true
  259. Time.TextSize = 14
  260. Time.TextWrapped = true
  261.  
  262. Top.Name = "Top"
  263. Top.Parent = Frame
  264. Top.BackgroundColor3 = Color3.new(0, 0, 0)
  265. Top.BackgroundTransparency = 0.5
  266. Top.Size = UDim2.new(1, 0, 0.150000006, 0)
  267. Top.Font = Enum.Font.SourceSans
  268. Top.Text = "Asked by: Memo1332"
  269. Top.TextColor3 = Color3.new(1, 1, 1)
  270. Top.TextScaled = true
  271. Top.TextSize = 14
  272. Top.TextWrapped = true
  273. Top.TextXAlignment = Enum.TextXAlignment.Left
  274.  
  275. TextButton.Parent = Top
  276. TextButton.AnchorPoint = Vector2.new(1, 0)
  277. TextButton.BackgroundColor3 = Color3.new(1, 1, 1)
  278. TextButton.BackgroundTransparency = 1
  279. TextButton.Position = UDim2.new(1, 0, 0, 0)
  280. TextButton.Size = UDim2.new(1, 0, 1, 0)
  281. TextButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
  282. TextButton.Font = Enum.Font.SourceSans
  283. TextButton.Text = "X"
  284. TextButton.TextColor3 = Color3.new(1, 1, 1)
  285. TextButton.TextScaled = true
  286. TextButton.TextSize = 14
  287. TextButton.TextWrapped = true
  288.  
  289. -- Scripts
  290.  
  291. local player = game.Players.Memo1332
  292. local poll = false
  293.  
  294.  
  295. player.Chatted:Connect(function(msg)
  296. if msg:sub(1,6):lower() == ";poll/" then
  297. if poll == false then
  298. poll = true
  299. local whoans1 = {}
  300. local whoans2 = {}
  301. local whona = {}
  302. local arg = string.split(msg:sub(7),"/")
  303. local ans1 = 0
  304. local ans2 = 0
  305. local na = 0
  306. local plrs = #game.Players:GetChildren()
  307. for i,v in pairs(game.Players:GetChildren()) do
  308. if v.Name == "Memo1332" then
  309. local clon = Vote:Clone()
  310. clon.Parent = v.PlayerGui
  311. clon.Frame.Question.Text = arg[1]
  312. clon.Frame.Top.Text = "Asked by: "..player.Name
  313. clon.Frame.Yes.Text = arg[2]
  314. clon.Frame.No.Text = arg[3]
  315. print(arg[1],arg[2],arg[3])
  316. clon.Frame:TweenPosition(UDim2.new(1,-10,1,-10),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.5,true)
  317. coroutine.resume(coroutine.create(function()
  318. for i=1,3 do
  319. if clon ~= nil and clon:FindFirstChild("Frame") ~= nil then
  320. clon.Frame.BackgroundColor3 = Color3.fromRGB(255,0,0)
  321. end
  322. wait(.3)
  323. if clon ~= nil and clon:FindFirstChild("Frame") ~= nil then
  324. clon.Frame.BackgroundColor3 = Color3.fromRGB(0,0,0)
  325. end
  326. wait(.3)
  327. end
  328. end))
  329. clon.Frame.Yes.MouseButton1Click:Connect(function()
  330. ans1 = ans1 + 1
  331. table.insert(whoans1,v.Name)
  332. clon:Destroy()
  333. end)
  334. clon.Frame.No.MouseButton1Click:Connect(function()
  335. ans2 = ans2 + 1
  336. table.insert(whoans2,v.Name)
  337. clon:Destroy()
  338. end)
  339. clon.Frame.Top.TextButton.MouseButton1Click:Connect(function()
  340. na = na + 1
  341. table.insert(whona,v.Name)
  342. clon:Destroy()
  343. end)
  344. coroutine.resume(coroutine.create(function()
  345. local bep = false
  346. for i=1,10 do
  347. local tim = (10-i) + 1
  348. if clon ~= nil and clon:FindFirstChild("Frame") ~= nil then
  349. clon.Frame.Time.Text = tostring(tim)
  350. wait(1)
  351. else
  352. break
  353. end
  354. if tim == 1 then bep = true end
  355. end
  356. repeat wait() until bep == true
  357. na = na + 1
  358. table.insert(whona,v.Name)
  359. wait()
  360. clon:Destroy()
  361. end))
  362. end
  363. wait(11)
  364. local clon = VoteResults:Clone()
  365. clon.Parent = player.PlayerGui
  366. clon.Frame:TweenPosition(UDim2.new(0.5,0,0.5,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,0.5,true)
  367. clon.Frame.Question.Text = arg[1]
  368. clon.Frame.AnswerGreen.AnswerName.Text = arg[2]
  369. clon.Frame.AnswerGreen.AnswerAmount.Text = tostring(ans1)
  370. clon.Frame.AnswerGrey.AnswerAmount.Text = tostring(na)
  371. clon.Frame.AnswerRed.AnswerName.Text = arg[3]
  372. clon.Frame.AnswerRed.AnswerAmount.Text = tostring(ans2)
  373. clon.Frame.Top.TextButton.MouseButton1Click:Connect(function()
  374. clon:Destroy()
  375. end)
  376. poll = false
  377. --Logging time
  378. warn("Players that chose "..arg[2]..":")
  379. for i,v in pairs(whoans1) do
  380. print(v)
  381. end
  382. warn("Players that chose "..arg[3]..":")
  383. for i,v in pairs(whoans2) do
  384. print(v)
  385. end
  386. warn("Players that did not choose:")
  387. for i,v in pairs(whona) do
  388. print(v)
  389. end
  390. else
  391. warn("There's another poll in progress")
  392. end
  393. end
  394. end
  395. end)
Add Comment
Please, Sign In to add comment