Guest User

Untitled

a guest
Jul 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.88 KB | None | 0 0
  1. -------------------------------
  2. -------------------------------
  3. -------------------------------
  4. --Nidoxs
  5. --The Seven Seas Interface
  6. --Started 10th July 2018
  7.  
  8. --All code below is in reference to a general Framework in which it operates, remote communication is used
  9. --between this Interface and the rest of the Framework to execute certain tasks such as setting a bounty on someone
  10. --or buying a product from the Store.
  11.  
  12. -------------------------------
  13. -------------------------------
  14. -------------------------------
  15.  
  16. local UI = script.Parent
  17. local Player = game.Players.LocalPlayer
  18. local PlayerGui = Player:WaitForChild("PlayerGui")
  19. local PlayerData = Player:WaitForChild("PlayerData")
  20. local Doubloons = PlayerData:WaitForChild("Doubloons")
  21.  
  22. local MPS = game:GetService("MarketplaceService")
  23.  
  24. local MainFrame = UI:WaitForChild("MainFrame")
  25. local GoldDisplay = MainFrame:WaitForChild("GoldDisplay")
  26. local GoldText = GoldDisplay:WaitForChild("GoldText")
  27. local GoldNotifier = GoldDisplay:WaitForChild("GoldNotifier")
  28.  
  29. local Sounds = UI:WaitForChild("Sounds")
  30. local CoinGain = Sounds:WaitForChild("CoinGain")
  31. local CoinLose = Sounds:WaitForChild("CoinLose")
  32. local Notify = Sounds:WaitForChild("Notify")
  33.  
  34. local GoldStore = MainFrame:WaitForChild("GoldStore")
  35. local StoreFrame = GoldStore:WaitForChild("StoreFrame")
  36. local StoreOpen = false
  37.  
  38. local Bounty = MainFrame:WaitForChild("Bounty")
  39. local Donate = MainFrame:WaitForChild("Donate")
  40.  
  41. local BountyButton = MainFrame:WaitForChild("BountyButton")
  42. local GoldButton = MainFrame:WaitForChild("GoldButton")
  43. local DonateButton = MainFrame:WaitForChild("DonateButton")
  44.  
  45. local BountyFrame = Bounty:WaitForChild("BountyFrame")
  46. local BountyScrollingFrame = BountyFrame:WaitForChild("ScrollingFrame")
  47. local BountyBox = Bounty:WaitForChild("BountyBox")
  48.  
  49. local DonateFrame = Donate:WaitForChild("DonateFrame")
  50. local DonateScrollingFrame = DonateFrame:WaitForChild("ScrollingFrame")
  51. local DonateBox = Donate:WaitForChild("DonateBox")
  52.  
  53. local PlaceBountyButton = Bounty:WaitForChild("PlaceBounty")
  54. local DonatePlaceButton = Donate:WaitForChild("DonateButton")
  55.  
  56. local Notification = UI:WaitForChild("Notification")
  57.  
  58. local NotificationText = Notification:WaitForChild("NotificationText")
  59.  
  60. local RS = game:GetService("ReplicatedStorage")
  61. local Framework = RS:WaitForChild("Framework")
  62. local Events = Framework:WaitForChild("Events")
  63. local Models = Framework:WaitForChild("Models")
  64. local Functions = Framework:WaitForChild("Functions")
  65.  
  66. local NotificationEvent = Events:WaitForChild("NotificationEvent")
  67. local PlaceBounty = Events:WaitForChild("PlaceBounty")
  68. local DonateEvent = Events:WaitForChild("DonateEvent")
  69.  
  70. local SubtractGold = Events:WaitForChild("SubtractGold")
  71. local CheckGoldFunction = Functions:WaitForChild("CheckGoldFunction")
  72.  
  73. local AlreadyNotifying = false
  74. local BountyListOpen = false
  75. local DonateListOpen = false
  76.  
  77. NotificationEvent.OnClientEvent:connect(function(TextToDisplay,Duration,Color)
  78. if AlreadyNotifying then repeat wait(.01) until not AlreadyNotifying end
  79.  
  80. AlreadyNotifying = true
  81. Notify:Play()
  82. NotificationText.Text = TextToDisplay
  83. NotificationText.TextColor3 = Color
  84. Notification:TweenPosition(UDim2.new(0.005,0,0.65,0),"Out","Quad",1)
  85. wait(Duration + 1)
  86. Notification:TweenPosition(UDim2.new(-1,0,0.65,0),"Out","Quad",1)
  87. AlreadyNotifying = false
  88. end)
  89.  
  90. GoldButton.MouseButton1Down:connect(function()
  91. if StoreOpen then
  92. StoreOpen = false
  93. StoreFrame.Visible = false
  94. else
  95. StoreOpen = true
  96. StoreFrame.Visible = true
  97. end
  98. end)
  99.  
  100. for i,v in pairs(StoreFrame:GetChildren())do
  101. if v:IsA("TextButton") then
  102. v.MouseButton1Down:connect(function()
  103. if v.Name == "100" then
  104. MPS:PromptProductPurchase(Player,313769100)
  105. elseif v.Name == "250" then
  106. MPS:PromptProductPurchase(Player,313769543)
  107. elseif v.Name == "500" then
  108. MPS:PromptProductPurchase(Player,313769757)
  109. elseif v.Name == "750" then
  110. MPS:PromptProductPurchase(Player,318256114)
  111. elseif v.Name == "1000" then
  112. MPS:PromptProductPurchase(Player,313769932)
  113. end
  114. StoreOpen = false
  115. StoreFrame.Visible = false
  116. end)
  117. end
  118. end
  119.  
  120. AlreadyShowing = false
  121.  
  122. Doubloons.Changed:connect(function()
  123. if AlreadyShowing then repeat wait(.01) until not AlreadyShowing end
  124.  
  125. AlreadyShowing = true
  126. local Current = tonumber(GoldText.Text)
  127. local New = Doubloons.Value
  128.  
  129. GoldText.Text = Doubloons.Value
  130.  
  131. local Difference = New - Current
  132.  
  133. if New > Current then
  134. GoldNotifier.Text = "+"..Difference
  135. GoldNotifier.TextColor3 = Color3.new(0,255,0)
  136. CoinGain:Play()
  137. else
  138. GoldNotifier.Text = Difference
  139. GoldNotifier.TextColor3 = Color3.new(255,0,0)
  140. CoinLose:Play()
  141. end
  142.  
  143. GoldNotifier.Position = UDim2.new(-0.007,0,-1.38,0)
  144.  
  145. GoldNotifier.Visible = true
  146.  
  147. GoldNotifier:TweenPosition(UDim2.new(-0.007,0,-4.5,0),"Out","Quad",2)
  148.  
  149. wait(2)
  150.  
  151. GoldNotifier.Visible = false
  152. AlreadyShowing = false
  153. end)
  154.  
  155. local BountyMenuLocked = false
  156. local DonateMenuLocked = false
  157.  
  158. local UpdateBountyList = function()
  159. local ListLayout = BountyScrollingFrame.UIListLayout
  160. ListLayout.Parent = script
  161. BountyScrollingFrame:ClearAllChildren()
  162.  
  163. ListLayout.Parent = BountyScrollingFrame
  164. for i,v in pairs(game.Players:GetChildren())do
  165. if v:IsA("Player") and v.Name ~= Player.Name then
  166. local ButtonClone = script.ButtonTemplate:Clone()
  167. ButtonClone.Name = v.Name
  168. ButtonClone.Text = v.Name
  169. ButtonClone.Visible = true
  170. ButtonClone.Parent = BountyScrollingFrame
  171. end
  172. end
  173. end
  174.  
  175. local UpdateGiveList = function()
  176. local ListLayout = DonateScrollingFrame.UIListLayout
  177. ListLayout.Parent = script
  178. DonateScrollingFrame:ClearAllChildren()
  179.  
  180. ListLayout.Parent = DonateScrollingFrame
  181. for i,v in pairs(game.Players:GetChildren())do
  182. if v:IsA("Player") and v.Name ~= Player.Name then
  183. local ButtonClone = script.ButtonTemplate:Clone()
  184. ButtonClone.Name = v.Name
  185. ButtonClone.Text = v.Name
  186. ButtonClone.Visible = true
  187. ButtonClone.Parent = DonateScrollingFrame
  188. end
  189. end
  190. end
  191.  
  192.  
  193. BountyButton.MouseButton1Down:connect(function()
  194. if BountyMenuLocked then return end
  195.  
  196. if DonateListOpen then return end
  197.  
  198. if not BountyListOpen then
  199. BountyFrame.Visible = true
  200. BountyListOpen = true
  201. UpdateBountyList()
  202.  
  203. for i,PlayerButton in pairs(BountyScrollingFrame:GetChildren())do
  204. if PlayerButton:IsA("TextButton") and PlayerButton.Name ~= Player.Name then
  205.  
  206. local Debounce = false
  207.  
  208. PlayerButton.MouseButton1Up:connect(function()
  209. if Debounce then return end
  210. Debounce = true
  211. PlayerToApplyBounty = PlayerButton.Name
  212. BountyFrame.Visible = false
  213. BountyMenuLocked = true
  214. BountyBox.Visible = true
  215. PlaceBountyButton.Visible = true
  216.  
  217. local Debounce = false
  218. end)
  219.  
  220.  
  221. end
  222. end
  223. else
  224. BountyFrame.Visible = false
  225. BountyListOpen = false
  226. end
  227. end)
  228.  
  229. DonateButton.MouseButton1Down:connect(function()
  230. if DonateMenuLocked then return end
  231.  
  232. if BountyListOpen then return end
  233.  
  234. if not DonateListOpen then
  235. DonateFrame.Visible = true
  236. DonateListOpen = true
  237. UpdateGiveList()
  238.  
  239. for i,PlayerButton in pairs(DonateScrollingFrame:GetChildren())do
  240. if PlayerButton:IsA("TextButton") and PlayerButton.Name ~= Player.Name then
  241.  
  242. local Debounce = false
  243.  
  244. PlayerButton.MouseButton1Up:connect(function()
  245. if Debounce then return end
  246. Debounce = true
  247. PlayerToDonateTo = PlayerButton.Name
  248. DonateFrame.Visible = false
  249. DonateMenuLocked = true
  250. DonateBox.Visible = true
  251. DonatePlaceButton.Visible = true
  252.  
  253. local Debounce = false
  254. end)
  255. end
  256. end
  257. elseif DonateListOpen then
  258. DonateFrame.Visible = false
  259. DonateListOpen = false
  260. end
  261. end)
  262.  
  263. PlaceBountyButton.MouseButton1Up:connect(function()
  264. if BountyBox.Text ~= "" and BountyBox.Text ~= nil then
  265. if typeof(tonumber(BountyBox.Text)) == "number" then
  266. local BountyAmountSet = tonumber(BountyBox.Text)
  267. if string.sub(BountyAmountSet,1,1) == "-" then
  268. DonateBox.Text = "CANNOT BE A NEGATIVE!"
  269. wait(.5)
  270. DonateBox.Text = ""
  271. return
  272. end
  273. if BountyAmountSet >= 50 then
  274. if CheckGoldFunction:InvokeServer() >= BountyAmountSet then
  275. PlaceBounty:FireServer(PlayerToApplyBounty,BountyAmountSet)
  276. print("Setting Bounty on "..PlayerToApplyBounty)
  277. BountyMenuLocked = false
  278. BountyListOpen = false
  279. BountyBox.Visible = false
  280. BountyBox.Text = ""
  281. PlaceBountyButton.Visible = false
  282. return
  283. else
  284. BountyBox.Text = "YOU DON'T HAVE THAT MANY DOUBLOONS!"
  285. wait(.5)
  286. BountyBox.Text = ""
  287. end
  288. elseif BountyAmountSet < 50 then
  289. BountyBox.Text = "ENTRY MUST BE AT LEAST 50 DOUBLOONS!"
  290. wait(.5)
  291. BountyBox.Text = ""
  292. end
  293. else
  294. BountyBox.Text = "ENTRY MUST BE A NUMBER, NOT A WORD OR A NEGATIVE!"
  295. wait(.5)
  296. BountyBox.Text = ""
  297. end
  298. else
  299. BountyBox.Text = "YOU NEED TO ENTER AN AMOUNT!"
  300. wait(.5)
  301. BountyBox.Text = ""
  302. end
  303. end)
  304.  
  305. DonatePlaceButton.MouseButton1Up:connect(function()
  306. if DonateBox.Text ~= "" and DonateBox.Text ~= nil then
  307. if typeof(tonumber(DonateBox.Text)) == "number" then
  308. local DonateAmount = tonumber(DonateBox.Text)
  309. if string.sub(DonateAmount,1,1) == "-" then
  310. DonateBox.Text = "CANNOT BE A NEGATIVE!"
  311. wait(.5)
  312. DonateBox.Text = ""
  313. return
  314. end
  315. if DonateAmount > 0 then
  316. if CheckGoldFunction:InvokeServer() >= DonateAmount then
  317. DonateEvent:FireServer(PlayerToDonateTo,DonateAmount)
  318. DonateMenuLocked = false
  319. DonateListOpen = false
  320. DonateBox.Visible = false
  321. DonateBox.Text = ""
  322. DonatePlaceButton.Visible = false
  323. else
  324. DonateBox.Text = "YOU DON'T HAVE ENOUGH DOUBLOONS TO GIVE!"
  325. wait(.5)
  326. DonateBox.Text = ""
  327. end
  328. elseif DonateAmount < 0 then
  329. DonateBox.Text = "MUST BE AT LEAST 1 GOLD!"
  330. wait(.5)
  331. DonateBox.Text = ""
  332. end
  333. else
  334. DonateBox.Text = "MUST BE A NUMBER AND NOT A NEGATIVE OR WORD!"
  335. wait(.5)
  336. DonateBox.Text = ""
  337. end
  338. else
  339. DonateBox.Text = "YOU NEED TO ENTER A VALUE!"
  340. wait(.5)
  341. DonateBox.Text = ""
  342. end
  343. end)
  344.  
  345.  
  346. GoldText.Text = Doubloons.Value
  347.  
  348. local ControlGui = PlayerGui:FindFirstChild("ControlGui")
  349. local Control = ControlGui:WaitForChild("BottomLeftControl")
  350. Control.Visible = false
Add Comment
Please, Sign In to add comment