I’m Trying to make a gamepass that when you buy it, the jumpPower will increase instantly to 100 from 50
I’m using a script in workspace to to activate the localscript thats inside StarterCharacterScripts:
local scr = game.StarterPlayer.StarterCharacterScripts.jump
local work = game.Workspace
local ID = "rbxassetid://829025029"
local marketplace = game:GetService("MarketplaceService")
-- it starts
work.ChildAdded:Connect(function(child)
if child.Name == "PlayerJump" then
if marketplace:UserOwnsGamePassAsync(child.UserId, 829025029) then -- id from gamepasses
scr.Enabled = true
end
end
end)
This is the localscript in StarterCharacterScripts: (disabled script)
local humanoid = script.Parent:FindFirstChild('Humanoid')
humanoid.UseJumpPower = true
humanoid.JumpPower = 100
For some reason, The localscript is not enabling when the first script runs, and it should make the JumpPower to 100 if the gramepass is purchased
This is the localscript that makes the button show a buying prompt
local jumppowerpass = script.Parent
local ID = "rbxassetid://829025029"
local marketplace = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
jumppowerpass.MouseButton1Click:Connect(function()
marketplace:PromptGamePassPurchase(player, 829025029)
end)
marketplace.PromptGamePassPurchaseFinished:Connect(function(player, gamepassID, purchased)
if purchased and gamepassID == 829025029 then
script.Parent.Parent.Visible = false
end
end)
Any help?