Advertisement
Guest User

IntermissionClient

a guest
Mar 29th, 2020
3,330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | None | 0 0
  1. local playersFrame = script.Parent:WaitForChild("PlayersFrame")
  2. local rStorage = game:GetService("ReplicatedStorage")
  3. local rEvents = rStorage:WaitForChild("RemoteEvents")
  4. local configs = rStorage:WaitForChild("Configs")
  5. local interText = script.Parent:WaitForChild("IntermissionText")
  6. local voteFrame = script.Parent:WaitForChild("VoteFrame")
  7.  
  8. local curVote
  9.  
  10. rEvents.AddPlayer.OnClientEvent:Connect(function(plr)
  11.     local image = Instance.new("ImageLabel",playersFrame)
  12.     image.Name = plr.UserId
  13.     image.BorderSizePixel = 0
  14.     image.BackgroundTransparency = .65
  15.     image.BackgroundColor3 = Color3.fromRGB(0,0,0)
  16.     image.Image = game.Players:GetUserThumbnailAsync(plr.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
  17. end)
  18.  
  19. rEvents.RemovePlayer.OnClientEvent:Connect(function(plr)
  20.     local image = playersFrame:FindFirstChild(plr.UserId)
  21.     if image then
  22.         image:Destroy()
  23.     end
  24. end)
  25.  
  26. rEvents.RemoveAllVotes.OnClientEvent:Connect(function()
  27.     for i,v in pairs(voteFrame:GetChildren()) do
  28.         if v.Name == "%Grid%" then
  29.            
  30.         else
  31.             v:Destroy()
  32.         end
  33.     end
  34. end)
  35.  
  36. rEvents.CreateVote.OnClientEvent:Connect(function(name,imageId)
  37.     local image = Instance.new("ImageButton",voteFrame)
  38.     image.Name = name
  39.     image.BorderSizePixel = 0
  40.     image.BackgroundTransparency = .65
  41.     image.BackgroundColor3 = Color3.fromRGB(0,0,0)
  42.     image.Image = "rbxassetid://"..imageId
  43.    
  44.     image.MouseButton1Click:Connect(function()
  45.         if curVote == image then
  46.            
  47.         else
  48.             if curVote == nil then
  49.             else
  50.                 rEvents.RemoveVote:FireServer(curVote.Name)
  51.             end
  52.            
  53.             wait()
  54.             curVote = image
  55.             rEvents.AddVote:FireServer(name)
  56.         end
  57.     end)
  58. end)
  59.  
  60. configs.Status:GetPropertyChangedSignal("Value"):Connect(function()
  61.     interText.Text = configs.Status.Value
  62. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement