Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStore2 = require(game.ServerScriptService:WaitForChild('DataStore2')) -- Require DataStore2 Module, a Wrapper for DataStore.
- local function checkAssets(plr) -- Check if Player Owns Asset.
- local Asset_Id = 000000000 -- The Asset Id
- local markerplaceservice = game:GetService('MarketplaceService') -- MarketPlaceService
- local ownsasset = markerplaceservice.PlayerOwnsAsset -- Parameter Shortcut
- local success, playerownsasset = pcall(ownsasset, markerplaceservice, plr, Asset_Id) -- PCall
- if playerownsasset then -- If returned True then
- print('Player Owns Asset.')
- return true -- Return True
- else -- Otherwise Return False
- warn('Player does not own Asset.') -- Warn Player Does NOT Have Asset
- end
- end
- -- // [[
- local rs = game:GetService('ReplicatedStorage') -- Replicated Storage.
- local remotefolder = rs:FindFirstChild('Remotes') -- Remote Folder
- local bountytrigger = remotefolder:FindFirstChild('Bounty') -- RemoteEvent
- local claimbounty = remotefolder:FindFirstChild('Claim') -- RemoteEvent
- local toll = remotefolder:FindFirstChild('PayToll') -- RemoteEvent
- local eventtrigger = remotefolder:FindFirstChild('EventTrigger') -- RemoteEvent
- local teleporttrigger = remotefolder:FindFirstChild('TeleportTrigger') -- RemoteEvent
- local blackmarkettrigger = remotefolder:FindFirstChild('BlackMarket') -- RemoteEvent
- local eventModule = require(rs.Resources.Events) -- Require Module, Events,
- local function sendbountyinfo(plr, target, val) -- Send Bounty Info( Creating a new Bounty. )
- local coinstore = DataStore2('ZetaCredit', plr) -- Player Currency
- if game.Players:FindFirstChild(target)then -- If the Players Target is in Game then...
- local player = game.Players:FindFirstChild(target) -- The Targets Player Instance.
- local bountystore = DataStore2('ZetaBounty', player) -- Target Players bounty amount.
- if val <= coinstore:Get()then -- If the Player can afford the Bounty requested then...
- coinstore:Increment(-val) -- Deduct amount from Player
- bountystore:Increment(val) -- Add Target Bounty.
- end
- end
- end
- local function claimTac(plr, event, target) -- Bounty System, Claim Bounty.
- if event == 'INFO' then -- Check Event Required
- print('SERVER CHECK')
- claimbounty:FireClient(plr, checkAssets(plr)) -- If the Player owns Gamepass, return true. Otherwise, false.
- elseif event == 'CLAIM' then -- If the Event is to Claim a Bounty then...
- if game.Players:FindFirstChild(target) then -- If the Target is in Game...
- local claimTarget = game.Players:FindFirstChild(target) -- The Target
- local claim = game.Players:FindFirstChild(plr.Name) -- The Player who is trying to claim the bounty.
- local charTarget = game.Workspace:FindFirstChild(claimTarget.Name) - The Targets Character.
- local bountystore = DataStore2('ZetaBounty', claimTarget) -- Bounty Data
- local coinstore = DataStore2('ZetaCredit', claim) -- Players Currency
- local bountycollectstore = DataStore2('ZetaBountyClaim', claim) -- Bounty Data ( # of Bounties Completed)
- local bountyaccumulated = DataStore2('ZetaBountyAccumulate', claim) Bounty Data ( Career amount earned )
- coinstore:Increment(bountystore:Get()) -- Gives Player the Amount states.
- bountyaccumulated:Increment(bountystore:Get()) -- Update Data
- bountystore:Increment(-bountystore:Get()) -- Update Data
- bountycollectstore:Increment(1) -- Update Data
- claimTarget:LoadCharacter() -- Respawn player with Bounty.
- end
- end
- end
- local function PayToll(plr, city) -- Not Part of Bounty System.
- local player = game.Players:FindFirstChild(plr.Name) -- Find Player
- local coinstore = DataStore2('ZetaCredit', player) -- Get DataStore2 Data.
- coinstore:Increment(-10) -- Pay the Required Toll.
- player.PlayerGui.TeleportGui.Enabled = true -- Enable Gui
- teleporttrigger:FireClient(plr, city) -- Fire the Client to Work out the Guis appearance.
- end
- local function EventCheck(plr, FORM, EventId) -- Not part of Bounty System, Check if they are in the Event.
- local m = eventModule.Events -- Fetch the Events from Module.
- local InEvent = plr.Bools.InEvent -- BoolValue in Player Stats, to tell if they are in an event.
- local Completed = plr.Bools.IsComplete -- BoolValue in PLayer Stats, to tell if they are finished.
- if game.Players:FindFirstChild(plr.Name)then -- If the Player is in Game.
- if FORM == 'CHECK' then -- Check the Players current Status in the Event
- local folder = plr:FindFirstChild(m[EventId]['NAME']) -- Find the Players Event.
- local count = folder:FindFirstChild(m[EventId]['GOAL']) -- Check the Amount of work done.
- local goal = folder:FindFirstChild('Goal') -- Check the Goal.
- local coinstore = DataStore2('ZetaCredit', plr) -- DataStore2 Data.
- if count.Value >= goal.Value then -- If the amount of work done is Greater than or equal to the goal then...
- print('CHECK TRUE')
- Completed.Value = true -- Completed = True
- folder:Destroy() -- Destroy the Folder
- InEvent.Value = false -- InEvent False
- coinstore:Increment(m[EventId]['PAY']) -- Pay the Player the amount listed.
- else -- Otherwise
- print('CHECK FALSE')
- Completed.Value = false -- Completed is False.
- end
- end
- if FORM == 'REGISTER'then -- Register a Player for an event.
- eventtrigger:FireClient(plr, EventId) -- Fire the Client to create the Event.
- print('CHECK')
- InEvent.Value = true -- InEvent = true
- Completed.Value = false -- Completed = False
- local folder = Instance.new('Folder', plr) -- Create a Folder
- folder.Name = m[EventId]['NAME'] -- Name the Folder the Event Name.
- local count = Instance.new('IntValue', folder) -- Create an IntValue
- count.Name = m[EventId]['GOAL'] -- Set the InValue Name to the Item they need. Parented under the Folder
- count.Value = 0 -- Obviously set it to Zero...
- local goal = Instance.new('IntValue', folder) -- New IntValue, which is for the Required amount, under Folder.
- goal.Name = 'Goal'
- goal.Value = m[EventId]['AMOUNT'] -- The Required Amount.
- end
- end
- end
- local function teleport(plr, destination) -- Not part of Bounty System, Teleports Player
- local player = game.Players:FindFirstChild(plr.Name) -- Finds the Player
- local char = player.Character -- Player Character
- local locations = game.Workspace:FindFirstChild('EventLocations'):FindFirstChild('Teleport') -- Fetch Teleport Locations
- if locations:FindFirstChild(destination)then -- Find their Destinations.
- char.Torso.CFrame = locations[destination].CFrame -- Teleport Via CFrame.
- end
- wait(3)
- player.PlayerGui.TeleportGui.Enabled = false -- Turn Off Gui
- end
- local function blackmarket(plr, call, item) -- Not part of Bounty System.
- local player = game.Players:FindFirstChild(plr.Name)
- local char = player.Character -- Player Character
- local location = game.Workspace:FindFirstChild('BlackmarketFolder'):WaitForChild('Center') -- Check if player is nearby.
- if call == 'OPEN' then -- Open Gui
- if (location.Position - char.Torso.Position).magnitude < 100 then -- If they are within 100 studs.
- player.PlayerGui.Blackmarket.Enabled = true
- end
- end
- if call == 'EXIT' then -- Close Gui
- player.PlayerGui.Blackmarket.Enabled = false
- end
- if call == 'PURCHASE' then -- Purchase Item
- local m = require(rs.Resources.Blackmarket) -- Require a Module, which contains the Items Data.
- local coinstore = DataStore2('ZetaCredit', player) -- DataStore2 Data.
- if coinstore:Get() >= m.Items[item]['price'] then -- If they have enough to purchase the Item.
- coinstore:Increment(m.Items[item]['deduct']) -- Deduct amount.
- local tool = game:GetService('ServerStorage'):FindFirstChild(item):Clone() -- Find the Tool they purchased.
- tool.Parent = plr.Backpack -- Give them the Tool.
- end
- end
- end
- -- Remote Events
- bountytrigger.OnServerEvent:Connect(sendbountyinfo) -- Sends Bounty Information to Create new Bounty.
- claimbounty.OnServerEvent:Connect(claimTac) -- Sends Request to Claim Bounty.
- toll.OnServerEvent:Connect(PayToll) -- Not part of Bounty System, but a Toll system.
- eventtrigger.OnServerEvent:Connect(EventCheck) -- Triggers Event, not part of Bounty System
- teleporttrigger.OnServerEvent:Connect(teleport) -- Teleports Player, not part of Bounty System.
- blackmarkettrigger.OnServerEvent:Connect(blackmarket) -- Blackmarket, not part of Bounty System.
Advertisement
Add Comment
Please, Sign In to add comment