Facebook
From Chartreuse Earthworm, 9 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 87
  1. local plyr = game.Players.LocalPlayer
  2. local character
  3.  
  4. plyr.CharacterAdded:Connect(function(c)
  5.  character = c
  6. end)
  7.  
  8. local gui = plyr:WaitForChild("PlayerGui")
  9. local ui = gui:WaitForChild("ui")
  10.  
  11. local assetObject = script:WaitForChild("Assets")
  12. local assets = {}
  13. for a,b in next,assetObject:GetChildren() do
  14.  assets[b.Name] = b
  15. end
  16.  
  17. local teams = game:GetService("Teams")
  18. local tS = game:GetService("TweenService")
  19. local lighting = game.Lighting
  20.  
  21. function tween(t,s,d,p,o)
  22.  return tS:Create(o,TweenInfo.new(t,Enum.EasingStyle[s],Enum.EasingDirection[d]),p)
  23. end
  24.  
  25. local rep = game.ReplicatedStorage
  26. local events = rep:WaitForChild("Events")
  27. local event = events:WaitForChild("event")
  28.  
  29. function teamChoose()
  30.  local chooseUI = assets.teamChoose:Clone()
  31.  chooseUI.Parent = ui
  32.  
  33.  tween(1,"Sine","Out",{Size = 24},lighting.Blur):Play()
  34.  
  35.  local finished
  36.  local workerDown,residentDown = chooseUI.worker.MouseButton1Down:Connect(function()
  37.   event:FireServer({reason = "changeTeam"; team = teams.Worker})
  38.   finished = true
  39.  end),chooseUI.resident.MouseButton1Down:Connect(function()
  40.   event:FireServer({reason = "changeTeam"; team = teams.Resident})
  41.   finished = true
  42.  end)
  43.  
  44.  repeat wait() until finished
  45.  
  46.  tween(0.5,"Sine","Out",{Size = 0},lighting.Blur):Play()
  47.  
  48.  workerDown:disconnect()
  49.  residentDown:disconnect()
  50.  
  51.  chooseUI:Destroy()
  52. end
  53.  
  54. teamChoose()´╗┐
  55.