So I have this script here to add speed when they join if they have a certain gamepass and it works completely:
01 | gps = game:GetService( "GamePassService" ); |
02 |
03 | id = script:WaitForChild( "GamePassID" ); |
04 | Speed = script:WaitForChild( "WalkSpeedAmount" ); |
05 |
06 | game.Players.PlayerAdded:connect( function (Player) |
07 | Player:WaitForDataReady() |
08 | if gps:PlayerHasPass(Player , id.Value) then |
09 | coroutine.resume(coroutine.create( function () |
10 | while wait() do |
11 | repeat wait() until Player.Character~ = nil |
12 | Player.Character:WaitForChild( "Humanoid" ).WalkSpeed = Speed.Value |
13 | end |
14 | end )) |
15 | end |
16 | end ) |
There is a GamePassID inside of the script and also the SpeedAmount. That all works fine and dandy but then when I use my Dev product scripts there is a problem. My Dev script gives speed, health, etc. when you buy that certain Dev product. It does at speed and everything its just when you have a gamepass that adds speed it does not add anything for some reason. It may be a MarketPlace error? Dev Script:
01 | local MarketplaceService = game:GetService( "MarketplaceService" ) |
02 | local AddHealthID = 22137556 --ENTER |
03 | local AddSpeedID = 22137544 --PASS |
04 | local AddGearID = 22137570 --IDS |
05 | local AddGear 2 ID = 22137564 --IDS |
06 | local AddGear 3 ID = 22137575 --HERE |
07 | local AddGear 4 ID = 22137566 --IDS |
08 | local PurchaseHistory = game:GetService( "DataStoreService" ):GetDataStore( "PurchaseHistory" ) |
09 | MarketplaceService.ProcessReceipt = function (receiptInfo) |
10 | local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId |
11 | if PurchaseHistory:GetAsync(playerProductKey) then |
12 | return Enum.ProductPurchaseDecision.PurchaseGranted |
13 | end |
14 | for i, player in ipairs (game.Players:GetPlayers()) do |
15 | if player.userId = = receiptInfo.PlayerId then |
If you could help me and make these two script compatible it would be really nice of you, THANKS!
So your problem is that if you've bought the Developer Product, the GamePass functions don't work?
This might be due to the fact that you're Setting the WalkSpeed value, rather than actually adding it.
So standard WalkSpeed is 16? Your Dev Product adds 15, from that moment it's 31. So since you're SETTING the WalkSpeed in the gamepass functions..
Speed = script:WaitForChild("WalkSpeedAmount");
Player.Character:WaitForChild("Humanoid").WalkSpeed = Speed.Value
If Speed's value is 31(or 30, since that makes more sense), then you won't see any change.
So to fix this? Add the WalkSpeed rather than Setting it.
01 | local gps = game:GetService( "GamePassService" ); |
02 | local id = script:WaitForChild( "GamePassID" ); |
03 | local Speed = script:WaitForChild( "WalkSpeedAmount" ); |
04 |
05 | game.Players.PlayerAdded:connect( function (Player) |
06 | Player:WaitForDataReady() |
07 | if gps:PlayerHasPass(Player , id.Value) then |
08 | coroutine.resume(coroutine.create( function () |
09 | while wait() do |
10 | repeat wait() until Player.Character~ = nil |
11 | local hum = Player.Character.Humanoid |
12 | hum.WalkSpeed = hum.WalkSpeed + Speed.Value |
13 | end |
14 | end )) |
15 | end |
16 | end ) |