Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How could i make this Bigger Duffel Bag Gamepass?

Asked by 7 years ago

I'm trying to make a bigger duffel bag gamepass. Here is what my script for money giving looks like :

01local debounce = false
02local playerfound = false
03 
04function CreateRegion3FromPart(Part)
05    return Region3.new(Part.Position-(Part.Size/2),Part.Position+(Part.Size/2))
06end
07 
08function GetPlayersInPart(part)
09    local region = CreateRegion3FromPart(part)
10    local partsInRegion = workspace:FindPartsInRegion3(region,nil,math.huge)
11    local Players = {}
12 
13 
14    for i,Part in pairs(partsInRegion) do
15        local player = game.Players:GetPlayerFromCharacter(Part.Parent)
View all 47 lines...

I'm trying to make it so if the player has the Bigger Duffel Bag gamepass [https://www.roblox.com/library/1607774359/Bigger-Duffel-Bag-PRE-ORDER] he will get 3.5k money instead of 1k. Would appreciate some help.

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You'd use PlayerHasPass from the gamepass service. https://wiki.roblox.com/index.php?title=API:Class/GamePassService/PlayerHasPass

It would look something like this.

01Players[i].Robbing.Value = true
02if game:GetService("GamePassService"):PlayerHasPass(Players[i], gamepassid) then -- Replace "gamepassid" with whatever gamepass you're using. In your case it would be 1607774359.
03    if Players[i].CashCollected.Value < 3500 then
04        Players[i].CashCollected.Value = Players[i].CashCollected.Value + 10
05else
06    if Players[i].CashCollected.Value < 1000 then
07        Players[i].CashCollected.Value = Players[i].CashCollected.Value + 10
08        end
09    end
10end

I haven't tested this however and it may not work. I'm not too sure but you can sort of get an idea of how it should work.

Also I would strongly suggest storing important values like Money and such, serverside using remote events and functions with filtering enabled so that you can avoid exploiters. https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

Edit:

Try this?

01local debounce = false
02local playerfound = false
03 
04function CreateRegion3FromPart(Part)
05    return Region3.new(Part.Position-(Part.Size/2),Part.Position+(Part.Size/2))
06end
07 
08function GetPlayersInPart(part)
09    local region = CreateRegion3FromPart(part)
10    local partsInRegion = workspace:FindPartsInRegion3(region,nil,math.huge)
11    local Players = {}
12 
13 
14    for i,Part in pairs(partsInRegion) do
15        local player = game.Players:GetPlayerFromCharacter(Part.Parent)
View all 52 lines...
0
This does not seem to work. Could you please put it in the whole script and make it the whole script so i can directly copy and paste the script? Thanks. DenisYordanov 9 — 7y
0
I edited the post try copy pasting that. Optimalpokemon123 37 — 7y
0
Still doesn't work. I don't think we make this work. DenisYordanov 9 — 7y
0
It may be because I had it as "Player[i]" Instead of "Players[i]" try it again I fixed it. Optimalpokemon123 37 — 7y
Ad

Answer this question