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

Double Jump Script isn't working when i test it?

Asked by 6 years ago
Edited 6 years ago

I've got a double jump gamepass script that doesn't seem to be working can someone explain? heres the code: local passId = 4916610 --Change to you're Game Pass ID. game.Players.PlayerAdded:connect(function() function isAuthenticated(player) -- checks to see if the player owns your pass return game:GetService("GamePassService"):PlayerHasPass(player, passId) end

game.Players.PlayerAdded:connect(function(plr)
     if isAuthenticated(plr) then
repeat wait(0.001) until game.Players.LocalPlayer.Character.Humanoid
         game.Players.LocalPlayer.Character.Humanoid.JumpPower = game.Players.LocalPlayer.Character.Humanoid.Power + 30---Change this line to what you want the Game Pass to do.
     end
end)

end)

0
Change game.Players.LocalPlayer.Character.Humanoid.Power + 30 into game.Players.LocalPlayer.Character.Humanoid.JumpPower + 30 cherrythetree 130 — 6y
0
and :connect is deprecated, :Connect. cherrythetree 130 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Hello, TimeExotic.

It is not working because LocalPlayer is nil on the server. You're also looking for a property called Power in the Humanoid, when no such property exists. Also, the PlayerHasPass method has been broken due to the new game pass update. You'll want to use the UserOwnsGamePassAsync method of the MarketplaceService.

local passId = 4916610
local MPS = game:GetService("MarketplaceService")

local function isAuthenticated(userId, gamePassId) -- define outside the PlayerAdded event
    return MPS:UserOwnsGamePassAsync(userId, gamePassId)
end

game:GetService("Players").PlayerAdded:Connect(function(plr) -- :connect is deprecated, use :Connect

    plr.CharacterAdded:Connect(function(char) -- wait for the character! 
        if isAuthenticated(plr.UserId, passId) then
            char.Humanoid.JumpPower = char.Humanoid.JumpPower + 30 
        end
    end)
end)
0
Thank you so much! Cheers! TimeExotic -6 — 6y
Ad

Answer this question