Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------
- -------------------------------
- -------------------------------
- --Nidoxs
- --The Seven Seas Interface
- --Started 10th July 2018
- --All code below is in reference to a general Framework in which it operates, remote communication is used
- --between this Interface and the rest of the Framework to execute certain tasks such as setting a bounty on someone
- --or buying a product from the Store.
- -------------------------------
- -------------------------------
- -------------------------------
- local UI = script.Parent
- local Player = game.Players.LocalPlayer
- local PlayerGui = Player:WaitForChild("PlayerGui")
- local PlayerData = Player:WaitForChild("PlayerData")
- local Doubloons = PlayerData:WaitForChild("Doubloons")
- local MPS = game:GetService("MarketplaceService")
- local MainFrame = UI:WaitForChild("MainFrame")
- local GoldDisplay = MainFrame:WaitForChild("GoldDisplay")
- local GoldText = GoldDisplay:WaitForChild("GoldText")
- local GoldNotifier = GoldDisplay:WaitForChild("GoldNotifier")
- local Sounds = UI:WaitForChild("Sounds")
- local CoinGain = Sounds:WaitForChild("CoinGain")
- local CoinLose = Sounds:WaitForChild("CoinLose")
- local Notify = Sounds:WaitForChild("Notify")
- local GoldStore = MainFrame:WaitForChild("GoldStore")
- local StoreFrame = GoldStore:WaitForChild("StoreFrame")
- local StoreOpen = false
- local Bounty = MainFrame:WaitForChild("Bounty")
- local Donate = MainFrame:WaitForChild("Donate")
- local BountyButton = MainFrame:WaitForChild("BountyButton")
- local GoldButton = MainFrame:WaitForChild("GoldButton")
- local DonateButton = MainFrame:WaitForChild("DonateButton")
- local BountyFrame = Bounty:WaitForChild("BountyFrame")
- local BountyScrollingFrame = BountyFrame:WaitForChild("ScrollingFrame")
- local BountyBox = Bounty:WaitForChild("BountyBox")
- local DonateFrame = Donate:WaitForChild("DonateFrame")
- local DonateScrollingFrame = DonateFrame:WaitForChild("ScrollingFrame")
- local DonateBox = Donate:WaitForChild("DonateBox")
- local PlaceBountyButton = Bounty:WaitForChild("PlaceBounty")
- local DonatePlaceButton = Donate:WaitForChild("DonateButton")
- local Notification = UI:WaitForChild("Notification")
- local NotificationText = Notification:WaitForChild("NotificationText")
- local RS = game:GetService("ReplicatedStorage")
- local Framework = RS:WaitForChild("Framework")
- local Events = Framework:WaitForChild("Events")
- local Models = Framework:WaitForChild("Models")
- local Functions = Framework:WaitForChild("Functions")
- local NotificationEvent = Events:WaitForChild("NotificationEvent")
- local PlaceBounty = Events:WaitForChild("PlaceBounty")
- local DonateEvent = Events:WaitForChild("DonateEvent")
- local SubtractGold = Events:WaitForChild("SubtractGold")
- local CheckGoldFunction = Functions:WaitForChild("CheckGoldFunction")
- local AlreadyNotifying = false
- local BountyListOpen = false
- local DonateListOpen = false
- NotificationEvent.OnClientEvent:connect(function(TextToDisplay,Duration,Color)
- if AlreadyNotifying then repeat wait(.01) until not AlreadyNotifying end
- AlreadyNotifying = true
- Notify:Play()
- NotificationText.Text = TextToDisplay
- NotificationText.TextColor3 = Color
- Notification:TweenPosition(UDim2.new(0.005,0,0.65,0),"Out","Quad",1)
- wait(Duration + 1)
- Notification:TweenPosition(UDim2.new(-1,0,0.65,0),"Out","Quad",1)
- AlreadyNotifying = false
- end)
- GoldButton.MouseButton1Down:connect(function()
- if StoreOpen then
- StoreOpen = false
- StoreFrame.Visible = false
- else
- StoreOpen = true
- StoreFrame.Visible = true
- end
- end)
- for i,v in pairs(StoreFrame:GetChildren())do
- if v:IsA("TextButton") then
- v.MouseButton1Down:connect(function()
- if v.Name == "100" then
- MPS:PromptProductPurchase(Player,313769100)
- elseif v.Name == "250" then
- MPS:PromptProductPurchase(Player,313769543)
- elseif v.Name == "500" then
- MPS:PromptProductPurchase(Player,313769757)
- elseif v.Name == "750" then
- MPS:PromptProductPurchase(Player,318256114)
- elseif v.Name == "1000" then
- MPS:PromptProductPurchase(Player,313769932)
- end
- StoreOpen = false
- StoreFrame.Visible = false
- end)
- end
- end
- AlreadyShowing = false
- Doubloons.Changed:connect(function()
- if AlreadyShowing then repeat wait(.01) until not AlreadyShowing end
- AlreadyShowing = true
- local Current = tonumber(GoldText.Text)
- local New = Doubloons.Value
- GoldText.Text = Doubloons.Value
- local Difference = New - Current
- if New > Current then
- GoldNotifier.Text = "+"..Difference
- GoldNotifier.TextColor3 = Color3.new(0,255,0)
- CoinGain:Play()
- else
- GoldNotifier.Text = Difference
- GoldNotifier.TextColor3 = Color3.new(255,0,0)
- CoinLose:Play()
- end
- GoldNotifier.Position = UDim2.new(-0.007,0,-1.38,0)
- GoldNotifier.Visible = true
- GoldNotifier:TweenPosition(UDim2.new(-0.007,0,-4.5,0),"Out","Quad",2)
- wait(2)
- GoldNotifier.Visible = false
- AlreadyShowing = false
- end)
- local BountyMenuLocked = false
- local DonateMenuLocked = false
- local UpdateBountyList = function()
- local ListLayout = BountyScrollingFrame.UIListLayout
- ListLayout.Parent = script
- BountyScrollingFrame:ClearAllChildren()
- ListLayout.Parent = BountyScrollingFrame
- for i,v in pairs(game.Players:GetChildren())do
- if v:IsA("Player") and v.Name ~= Player.Name then
- local ButtonClone = script.ButtonTemplate:Clone()
- ButtonClone.Name = v.Name
- ButtonClone.Text = v.Name
- ButtonClone.Visible = true
- ButtonClone.Parent = BountyScrollingFrame
- end
- end
- end
- local UpdateGiveList = function()
- local ListLayout = DonateScrollingFrame.UIListLayout
- ListLayout.Parent = script
- DonateScrollingFrame:ClearAllChildren()
- ListLayout.Parent = DonateScrollingFrame
- for i,v in pairs(game.Players:GetChildren())do
- if v:IsA("Player") and v.Name ~= Player.Name then
- local ButtonClone = script.ButtonTemplate:Clone()
- ButtonClone.Name = v.Name
- ButtonClone.Text = v.Name
- ButtonClone.Visible = true
- ButtonClone.Parent = DonateScrollingFrame
- end
- end
- end
- BountyButton.MouseButton1Down:connect(function()
- if BountyMenuLocked then return end
- if DonateListOpen then return end
- if not BountyListOpen then
- BountyFrame.Visible = true
- BountyListOpen = true
- UpdateBountyList()
- for i,PlayerButton in pairs(BountyScrollingFrame:GetChildren())do
- if PlayerButton:IsA("TextButton") and PlayerButton.Name ~= Player.Name then
- local Debounce = false
- PlayerButton.MouseButton1Up:connect(function()
- if Debounce then return end
- Debounce = true
- PlayerToApplyBounty = PlayerButton.Name
- BountyFrame.Visible = false
- BountyMenuLocked = true
- BountyBox.Visible = true
- PlaceBountyButton.Visible = true
- local Debounce = false
- end)
- end
- end
- else
- BountyFrame.Visible = false
- BountyListOpen = false
- end
- end)
- DonateButton.MouseButton1Down:connect(function()
- if DonateMenuLocked then return end
- if BountyListOpen then return end
- if not DonateListOpen then
- DonateFrame.Visible = true
- DonateListOpen = true
- UpdateGiveList()
- for i,PlayerButton in pairs(DonateScrollingFrame:GetChildren())do
- if PlayerButton:IsA("TextButton") and PlayerButton.Name ~= Player.Name then
- local Debounce = false
- PlayerButton.MouseButton1Up:connect(function()
- if Debounce then return end
- Debounce = true
- PlayerToDonateTo = PlayerButton.Name
- DonateFrame.Visible = false
- DonateMenuLocked = true
- DonateBox.Visible = true
- DonatePlaceButton.Visible = true
- local Debounce = false
- end)
- end
- end
- elseif DonateListOpen then
- DonateFrame.Visible = false
- DonateListOpen = false
- end
- end)
- PlaceBountyButton.MouseButton1Up:connect(function()
- if BountyBox.Text ~= "" and BountyBox.Text ~= nil then
- if typeof(tonumber(BountyBox.Text)) == "number" then
- local BountyAmountSet = tonumber(BountyBox.Text)
- if string.sub(BountyAmountSet,1,1) == "-" then
- DonateBox.Text = "CANNOT BE A NEGATIVE!"
- wait(.5)
- DonateBox.Text = ""
- return
- end
- if BountyAmountSet >= 50 then
- if CheckGoldFunction:InvokeServer() >= BountyAmountSet then
- PlaceBounty:FireServer(PlayerToApplyBounty,BountyAmountSet)
- print("Setting Bounty on "..PlayerToApplyBounty)
- BountyMenuLocked = false
- BountyListOpen = false
- BountyBox.Visible = false
- BountyBox.Text = ""
- PlaceBountyButton.Visible = false
- return
- else
- BountyBox.Text = "YOU DON'T HAVE THAT MANY DOUBLOONS!"
- wait(.5)
- BountyBox.Text = ""
- end
- elseif BountyAmountSet < 50 then
- BountyBox.Text = "ENTRY MUST BE AT LEAST 50 DOUBLOONS!"
- wait(.5)
- BountyBox.Text = ""
- end
- else
- BountyBox.Text = "ENTRY MUST BE A NUMBER, NOT A WORD OR A NEGATIVE!"
- wait(.5)
- BountyBox.Text = ""
- end
- else
- BountyBox.Text = "YOU NEED TO ENTER AN AMOUNT!"
- wait(.5)
- BountyBox.Text = ""
- end
- end)
- DonatePlaceButton.MouseButton1Up:connect(function()
- if DonateBox.Text ~= "" and DonateBox.Text ~= nil then
- if typeof(tonumber(DonateBox.Text)) == "number" then
- local DonateAmount = tonumber(DonateBox.Text)
- if string.sub(DonateAmount,1,1) == "-" then
- DonateBox.Text = "CANNOT BE A NEGATIVE!"
- wait(.5)
- DonateBox.Text = ""
- return
- end
- if DonateAmount > 0 then
- if CheckGoldFunction:InvokeServer() >= DonateAmount then
- DonateEvent:FireServer(PlayerToDonateTo,DonateAmount)
- DonateMenuLocked = false
- DonateListOpen = false
- DonateBox.Visible = false
- DonateBox.Text = ""
- DonatePlaceButton.Visible = false
- else
- DonateBox.Text = "YOU DON'T HAVE ENOUGH DOUBLOONS TO GIVE!"
- wait(.5)
- DonateBox.Text = ""
- end
- elseif DonateAmount < 0 then
- DonateBox.Text = "MUST BE AT LEAST 1 GOLD!"
- wait(.5)
- DonateBox.Text = ""
- end
- else
- DonateBox.Text = "MUST BE A NUMBER AND NOT A NEGATIVE OR WORD!"
- wait(.5)
- DonateBox.Text = ""
- end
- else
- DonateBox.Text = "YOU NEED TO ENTER A VALUE!"
- wait(.5)
- DonateBox.Text = ""
- end
- end)
- GoldText.Text = Doubloons.Value
- local ControlGui = PlayerGui:FindFirstChild("ControlGui")
- local Control = ControlGui:WaitForChild("BottomLeftControl")
- Control.Visible = false
Add Comment
Please, Sign In to add comment