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.
01 | Players [ i ] .Robbing.Value = true |
02 | if game:GetService( "GamePassService" ):PlayerHasPass(Players [ i ] , gamepassid) then |
03 | if Players [ i ] .CashCollected.Value < 3500 then |
04 | Players [ i ] .CashCollected.Value = Players [ i ] .CashCollected.Value + 10 |
06 | if Players [ i ] .CashCollected.Value < 1000 then |
07 | Players [ i ] .CashCollected.Value = Players [ i ] .CashCollected.Value + 10 |
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?
02 | local playerfound = false |
04 | function CreateRegion 3 FromPart(Part) |
05 | return Region 3. new(Part.Position-(Part.Size/ 2 ),Part.Position+(Part.Size/ 2 )) |
08 | function GetPlayersInPart(part) |
09 | local region = CreateRegion 3 FromPart(part) |
10 | local partsInRegion = workspace:FindPartsInRegion 3 (region, nil , math.huge ) |
14 | for i,Part in pairs (partsInRegion) do |
15 | local player = game.Players:GetPlayerFromCharacter(Part.Parent) |
18 | for i, v in pairs (Players) do |
19 | if Players [ i ] .Name = = player.Name then |
24 | if playerfound = = false then |
25 | table.insert(Players,player) |
31 | for i, v in pairs (Players) do |
33 | if Players [ i ] .Robbing.Value = = false then |
34 | game.ReplicatedStorage.ShowRobberyGUI:FireClient(Players [ i ] ) |
36 | Players [ i ] .Robbing.Value = true |
37 | if not game:GetService( "GamePassService" ):PlayerHasPass(Players [ i ] , 1607774359 ) then |
38 | if Players [ i ] .CashCollected.Value < 1000 then |
39 | Players [ i ] .CashCollected.Value = Players [ i ] .CashCollected.Value + 10 |
42 | if Players [ i ] .CashCollected.Value < 3500 then |
43 | Players [ i ] .CashCollected.Value = Players [ i ] .CashCollected.Value + 10 |
51 | GetPlayersInPart(game.Workspace.Detector) |