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

+100 WalkSpeed when developer product bought?

Asked by
DanzLua 2879 Moderation Voter Community Moderator
10 years ago

Hey, i have this script which give u +100 walk speed when u buy a developer product, the problem is when i go on my game and buy it so i can test it out, it doesn't make me walk faster.

--[[This script goes inside of a TextBox which should be inside of a ScreenGui]]
productId = 21073044 -- Replace 123123123 with the id of your developer product.

local MarketplaceService = Game:GetService("MarketplaceService")
function UsernameFromID(ID)
    if type(ID) ~= "number" then
    return
    end
    local sets = game:service("InsertService"):GetUserSets(ID)
    for k, v in next, sets do
        if v.Name == "My Models" then
            return v.CreatorName
        end
    end
end
function giveRewards(player)

        Workspace.player.Humanoid.WalkSpeed = Workspace.player.Humanoid.WalkSpeed + 100

    return Enum.ProductPurcaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
    giveRewards(UsernameFromID(receiptInfo.PlayerId))
end
script.Parent.MouseButton1Down:connect(function()
    Game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
end)

EXTRA Can any one help me fix the script below which is like the one on the top but it gives u +15 Health, Thank you.

--[[This script goes inside of a TextBox which should be inside of a ScreenGui]]
productId = 20986884 -- Replace 123123123 with the id of your developer product.

local MarketplaceService = Game:GetService("MarketplaceService")
function UsernameFromID(ID)
    if type(ID) ~= "number" then
    return
    end
    local sets = game:service("InsertService"):GetUserSets(ID)
    for k, v in next, sets do
        if v.Name == "My Models" then
            return v.CreatorName
        end
    end
end
function giveRewards(player)
    local human = player.Parent:findFirstChild("Humanoid")

        human.MaxHealth = human.MaxHealth + 15
       human.Health = human.Health + 15

    return Enum.ProductPurcaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
    giveRewards(UsernameFromID(receiptInfo.PlayerId))
end
script.Parent.MouseButton1Down:connect(function()
    Game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
end)

Thank you

2 answers

Log in to vote
2
Answered by 10 years ago

Well obviously. A Humanoid's default WalkSpeed is 16. And a Humanoid's default MaxHealth is 100 So. Just do.

wait(7) -- each time you respawn. Don't touch it. You can only do higher
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 116
wait(7) -- each time you respawn. Don't touch it. You can only do higher
game.Players.LocalPlayer.Character.MaxHealth = 115
game.Players.LocalPlayer.Character.Health = 115

Hope this helps!

Ad
Log in to vote
-1
Answered by 7 years ago

to add and subtract walkspeed or jumppower do

to change walkspeed to JumpPower just change WalkSpeed to JumpPower :D

Make sure you make a developer product first and then copy the id of the product and rename the scripts name as the id!

local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
deb = 0

script.Parent.MouseButton1Click:connect(function()
local marketId = script.Name --this is the id of your developer product, rename script to id!
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
plr.Character.Humanoid.WalkSpeed = plr.Character.Humanoid.WalkSpeed + 100
wait(1)
deb = 0
end
end
end
end)
0
This was 2 years agooooo m88888 ;pp DanzLua 2879 — 7y
0
lol Goldenkings11 -11 — 7y

Answer this question