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

Need help with Dev Products ?

Asked by
Tixy12 0
10 years ago

Well I want a dev product to give health and speed and to be able to stack. I do not want the health to be restored but to just add to there maximum health. And when they die they lose the speed or health whatever they bought forever until they buy more. My recent problem with it is that you lose it on death but when you rejoin the game you get all the speed you paid for and i don't want that with the gear or health and neither the speed I want them all to be gone from the people forever until they buy more. Hope you guys can help! :D

If you got a reply tell me the script or maybe a link. :P If you know just one of those scripts to just add speed let me know you don't have to give me all three of them .! Thank you for reading! Not a request you dont need to! :)

Since I am having problems with my speed one where it adds speed and you lose it when you die but when you rejoin you get all of it back!

Here is the script I have in the starter pack:

local developerProduct = 20433249 -- Id of the developer product local speedInc = 15 --Change this to the amount of Walkspeed you'd like to give.

Game:GetService("MarketplaceService").ProcessReceipt = function(receipt)
    if receipt.ProductId == developerProduct then -- the speed dev product
        for i,v in pairs(game.Players:GetPlayers()) do -- loop through the players
            if v.userId == receipt.PlayerId then -- if they're the player that bought it
                if v.Character and v.Character:FindFirstChild("Humanoid") then
                    v.Character.Humanoid.WalkSpeed = v.Character.Humanoid.WalkSpeed + speedInc -- add speedinc to their current walkspeed
                end
            end
        end
    end
end

And here is the one in the button:

local marketplace = Game:GetService("MarketplaceService") local developerProduct = 20433249 -- id of the developer product local player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
    marketplace:PromptProductPurchase(player, developerProduct) -- prompt the purchase
end)

You dont have to help its not a request only if you want to :)!

1 answer

Log in to vote
1
Answered by 10 years ago

Alright so I know you understand this isn't a request site but your issue is that the Dev Product keeps recurring purchase. As a simple fix I added into my own system is a PromptingPurchase Boolean and this makes sure that if it's false then it will NOT register the actions made by

Game:GetService("MarketplaceService").ProcessReceipt = function(receipt)

So what you want to do is add the Boolean check in

 if v.Character and v.Character:FindFirstChild("Humanoid") then
            if PromptingPurchase.Value == false then return end
                    v.Character.Humanoid.WalkSpeed = v.Character.Humanoid.WalkSpeed + speedInc -- add speedinc to their current walkspeed
                end

Sorry this became difficult to understand but what you need to do is a Boolean check to see if they are even making a purchase at all and if they are you NEED to enable this boolean value to true at

PromptingPurchase.Value = true MarketPlace:PromptPurchase()

0
How do you add a boolean check. Im sorry i am a noob at this stuff..? Tixy12 0 — 10y
0
Im lost i am confused with the script what do i do with it? Tixy12 0 — 10y
1
Sorry for confusion I edited it and hopefully you can read it more thoroughly NovusTheory 133 — 10y
0
I am confused sent you a party on ROBLOX so you can help me in a efficent way but you dont have to. Tixy12 0 — 10y
Ad

Answer this question