Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.79 KB | None | 0 0
  1. --script:Destroy()
  2. Banned = {}
  3. Ranks = {
  4. User = {},
  5. Moderator = {},
  6. Admin = {},
  7. Owner = {"CottenEyedMario"}
  8. }
  9. Commands = {
  10. User = {"cmds", "r", "m", "h", "info","Dismiss"},
  11. Moderator = {"cmds", "r", "kill", "jail", "m", "h", "info","Dismiss"},
  12. Admin = {"cmds", "r", "kill", "jail", "kick", "m", "h", "info","gethat","music", "remind","Dismiss"},
  13. Owner = {"cmds", "r", "kill", "jail", "kick", "m", "h", "info", "gethat", "music", "remind", "add", "remove", "rank", "Dismiss"}
  14. }
  15.  
  16. function Output(tab, plyr, func)
  17. local Tablets = {}
  18. if workspace:findFirstChild("Hyperspace"..plyr.Name.."") then
  19. workspace:findFirstChild("Hyperspace"..plyr.Name..""):Destroy()
  20. end
  21. m = Instance.new("Model", workspace)
  22. m.Name = "Hyperspace"..plyr.Name..""
  23. for i = 1, #tab do
  24. local p = Instance.new("Part", m)
  25. p.Name = tostring(tab[i])
  26. p.Locked = true
  27. p.Size = Vector3.new(5, 4, 0.25)
  28. p.TopSurface, p.BottomSurface = "Smooth", "Smooth"
  29. p.Transparency = 0.5
  30. p.Anchored = true
  31. p.CanCollide = false
  32. p.BrickColor = BrickColor.new("Dark stone grey")
  33. local selectionBox = Instance.new("SelectionBox",p)
  34. selectionBox.Adornee = p
  35. selectionBox.Transparency = 0.5
  36. selectionBox.Color = BrickColor.new("Fossil")
  37. p.CFrame = plyr.Character.Torso.CFrame * CFrame.Angles(0, math.rad(i*#tab), 0)
  38. local bg = Instance.new("SurfaceGui", p)
  39. bg.Face = "Front"
  40. bg.CanvasSize = Vector2.new(500,500)
  41. bg.Adornee = p
  42. local frame = Instance.new("Frame", bg)
  43. frame.BackgroundTransparency = 1
  44. frame.Size = UDim2.new(1, 0, 1, 0)
  45. local tl = Instance.new("TextLabel", frame)
  46. tl.BackgroundTransparency = 1
  47. tl.Size = UDim2.new(1, 0, 1, 0)
  48. tl.TextWrapped = true
  49. tl.TextScaled = true
  50. tl.Text = tostring(tab[i])
  51. tl.TextStrokeTransparency = 0
  52. tl.TextStrokeColor3 = p.BrickColor.Color
  53. if script:findFirstChild(plyr.Name) then
  54. a = script:findFirstChild(plyr.Name)
  55. if a.Rank.Value == 1 then
  56. selectionBox.Color = BrickColor.new("Mauve")
  57. tl.TextStrokeColor3 = BrickColor.new("Mauve").Color
  58. elseif a.Rank.Value == 2 then
  59. selectionBox.Color = BrickColor.new("Bright yellow")
  60. tl.TextStrokeColor3 = BrickColor.new("Bright yellow").Color
  61. elseif a.Rank.Value == 3 then
  62. selectionBox.Color = BrickColor.new("Crimson")
  63. tl.TextStrokeColor3 = BrickColor.new("Crimson").Color
  64. elseif a.Rank.Value == 4 then
  65. selectionBox.Color = BrickColor.new(196)
  66. tl.TextStrokeColor3 = BrickColor.new(196).Color
  67. else
  68.  
  69. end
  70. end
  71. if p.Name == "Dismiss" then
  72. p.BrickColor = BrickColor.new("Really red")
  73. selectionBox.Color = BrickColor.new("Really red")
  74. tl.TextStrokeColor3 = Color3.new(1, 0, 0)
  75. local cd = Instance.new("ClickDetector", p)
  76. cd.MaxActivationDistance = 500
  77. cd.MouseClick:connect(function(plr)
  78. if plr.Name == plyr.Name then
  79. if tl.Text == "Dismiss" then
  80. for i,v in pairs(Tablets) do
  81. table.remove(Tablets, i)
  82. game:GetService'RunService'.Heartbeat:wait()
  83. end
  84. for i,v in pairs(workspace["Hyperspace"..plyr.Name]:GetChildren()) do
  85. v:Destroy()
  86. wait()
  87. end
  88. end
  89. end
  90. end)
  91. else
  92. if func and p.Name ~= "Dismiss" then
  93. local cd = Instance.new("ClickDetector", p)
  94. cd.MaxActivationDistance = 500
  95. cd.MouseClick:connect(func)
  96. end
  97. end
  98. table.insert(Tablets, p)
  99. end
  100. local rot = 0
  101. if #Tablets >= 10 then
  102. local dist = #Tablets/2
  103. else
  104. local dist = 5
  105. end
  106. local rad = 4 + (#Tablets * 0.3) --Change if you want
  107. game:GetService'RunService'.RenderStepped:connect(function()
  108. rot = rot + 1
  109. for i,v in pairs(Tablets) do
  110. local x = math.sin((i / #Tablets - (0.3 / #Tablets) + rot * 2) * math.pi * 2) * rad
  111. local z = math.cos((i / #Tablets - (0.3 / #Tablets) + rot * 2) * math.pi * 2) * rad
  112. local arotation = Vector3.new(x, y, z) + plyr.Character.Torso.CFrame.p
  113. local brotation = v.CFrame.p
  114. local crotation = (arotation * .1 + brotation * .9)
  115. v.CFrame = CFrame.new(crotation, plyr.Character.Torso.CFrame.p) * CFrame.new(0, math.sin(rot/10)/50, dist)
  116. end
  117. end)
  118. end
  119.  
  120. function fP(player)
  121. for i,v in pairs(game.Players:GetPlayers()) do
  122. if v.Name:match(player) then
  123. return v
  124. else
  125. return nil
  126. end
  127. end
  128. end
  129.  
  130. function tC(table, val)
  131. for i,v in pairs(table) do
  132. if v:match(val) then
  133. return v
  134. else
  135. return nil
  136. end
  137. end
  138. end
  139.  
  140. function SaveUser(UN, PW, RNK, PLYR, SENDER)
  141. plyr = fP(PLYR.Name)
  142. if plyr then
  143. accname = script:findFirstChild(plyr.Name)
  144. if accname then
  145. Output({"This user is already created an account", "Dismiss"}, SENDER)
  146. Output({"As a reminder, "..plyr.Name.." your credentials will be given to you now,", accname.Username.Value, accname.Password.Value, "Please don't forget to log in.", "Dismiss"}, plyr)
  147. else
  148. newUser = Instance.new("Folder", script)
  149. newUser.Name = plyr.Name
  150. UserName = Instance.new("StringValue", newUser)
  151. UserName.Name = "Username"
  152. UserName.Value = UN
  153. PassWord = Instance.new("StringValue", newUser)
  154. PassWord.Name = "Password"
  155. PassWord.Value = PW
  156. Rank = Instance.new("NumberValue", newUser)
  157. Rank.Name = "Rank"
  158. Rank.Value = RNK
  159. LoggedIn = Instance.new("BooleanValue", newUser)
  160. LoggedIn.Name = "Active"
  161. LoggedIn.Value = false
  162. if RNK == 1 then
  163. Output({"Welcome to Hyperspace!", "Please log in using 'login Username/Password'", "Use cmds to view all commands in your rank!", "USER: "..UN, "PASS: "..PW, "RANK: User", "Dismiss"}, plyr)
  164. elseif RNK == 2 then
  165. Output({"Welcome to Hyperspace!", "Please log in using 'login Username/Password'", "Use cmds to view all commands in your rank!", "USER: "..UN, "PASS: "..PW, "RANK: Moderator", "Dismiss"}, plyr)
  166. elseif RNK == 3 then
  167. Output({"Welcome to Hyperspace!", "Please log in using 'login Username/Password'", "Use cmds to view all commands in your rank!", "USER: "..UN, "PASS: "..PW, "RANK: Admin", "Dismiss"}, plyr)
  168. elseif RNK == 4 then
  169. Output({"Welcome to Hyperspace!", "Please log in using 'login Username/Password'", "Use cmds to view all commands in your rank!", "USER: "..UN, "PASS: "..PW, "RANK: Owner", "Dismiss"}, plyr)
  170. end
  171. end
  172. end
  173. end
  174.  
  175. function firstUse(PLYR, RNK)
  176. plyr = fP(PLYR.Name)
  177. if plyr then
  178. Output({"Welcome to Hyperspace!", "Please create your account using the following command", "createnew Username/Password", "These messages will be removed once you have done so."}, plyr)
  179. OneTime = plyr.Chatted:connect(function(msg)
  180. if msg:sub(1,10) == "createnew " then
  181. bet1 = nil
  182. bet2 = nil
  183. for i = 1, msg:len() do
  184. if msg[i] == "/" then
  185. bet1 = msg:sub(11, i-1)
  186. bet2 = msg:sub(i+1)
  187. end
  188. end
  189. SaveUser(bet1, bet2, RNK, plyr)
  190. plyr.Chatted:connect(function(msg) oC(msg, plyr) end)
  191. OneTime:disconnect()
  192. end
  193. end)
  194. end
  195. end
  196.  
  197. function logIn(PLYR, UN, PW)
  198. local plyr = fP(PLYR.Name)
  199. if plyr then
  200. if plyr.Name == PLYR then
  201. acc = script:findFirstChild(plyr.Name)
  202. if acc then
  203. if acc.Username.Value == UN and acc.Password.Value == PW then
  204. if acc.Active.Value == true then
  205. Output({"You are already logged into Hyperspace", "Dismiss"}, plyr)
  206. else
  207. acc.Active.Value = true
  208. Output({"Sucessfully logged into Hyperspace!", "Be wise and don't abuse!", "Dismiss"}, plyr)
  209. end
  210. else
  211. Output({"ERROR!", "Missing account and/or invalid credentials!", "Ask an admin / owner for a reminder!"}, plyr)
  212. end
  213. end
  214. end
  215. end
  216. end
  217.  
  218. function logOut(PLYR, UN, PW)
  219. local plyr = fP(PLYR.Name)
  220. if plyr then
  221. if plyr.Name == PLYR then
  222. acc = script:findFirstChild(plyr.Name)
  223. if acc then
  224. if acc.Username.Value == UN and acc.Password.Value == PW then
  225. if acc.Active.Value == false then
  226. Output({"You are already logged out of Hyperspace", "Dismiss"}, plyr)
  227. else
  228. acc.Active.Value = false
  229. Output({"Sucessfully logged out of Hyperspace!", "Thanks for using the admin!", "Dismiss"}, plyr)
  230. end
  231. else
  232. Output({"ERROR!", "Missing account and/or invalid credentials!", "Ask an admin / owner for a reminder!"}, plyr)
  233. end
  234. end
  235. end
  236. end
  237. end
  238.  
  239. function oC(msg, plyr)
  240. acc = script:findFirstChild(plyr)
  241. rnk = nil
  242. active = nil
  243. if acc then
  244. rnk = acc.Rank.Value
  245. active = acc.Active.value
  246. end
  247. if msg:sub(1, 6) == "login " then
  248. bet1 = nil
  249. bet2 = nil
  250. for i = 1, msg:len() do
  251. if msg:sub(i) == "/" then
  252. bet1 = msg:sub(7, i-1)
  253. bet2 = msg:sub(i+1)
  254. end
  255. end
  256. logIn(plyr, bet1, bet2)
  257. elseif msg:sub(1,7) == "logout " then
  258. bet1 = nil
  259. bet2 = nil
  260. for i = 1, msg:len() do
  261. if msg:sub(i) == "/" then
  262. bet1 = msg:sub(8, i-1)
  263. bet2 = msg:sub(i+1)
  264. end
  265. end
  266. logOut(plyr, bet1, bet2)
  267. elseif msg:sub(1,3) == "cmds" then
  268. if rnk == 1 then
  269. Output(Commands.User, plyr)
  270. elseif rnk == 2 then
  271. Output(Commands.Moderator, plyr)
  272. elseif rnk == 3 then
  273. Output(Commands.Admin, plyr)
  274. elseif rnk == 4 then
  275. Output(Commands.Owner, plyr)
  276. end
  277. end
  278. end
  279.  
  280. for i,v in pairs(game.Players:GetPlayers()) do
  281. if tC(Ranks.User, v.Name) then
  282. firstUse(v, 1)
  283. elseif tC(Ranks.Moderator, v.Name) then
  284. firstUse(v, 2)
  285. elseif tC(Ranks.Admin, v.Name) then
  286. firstUse(v, 3)
  287. elseif tC(Ranks.Owner, v.Name) then
  288. firstUse(v, 4)
  289. end
  290. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement