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

Health Boost Gamepass isn't working on Online?

Asked by 6 years ago

Hello, You know the gamepass id's are changed. I want to make Health Boost Gamepass on Filtering Enabled. Its working on Roblox Studio but its not working on Online! Scripts:

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local gamePassID = 3919464
local health = 250
local function onPlayerAdded(player)
    local hasPass = false
    local success, message = pcall(function()
        hasPass = MarketplaceService:UserOwnsGamePassAsync(player.userId, gamePassID)
    end)

    if not success then
        warn("Error while checking if player has pass: " .. tostring(message))
        return
    end

    if hasPass == true then
        print(player.Name .. " owns the game pass with ID " .. gamePassID)
        if player.Character ~= nil then
        player.Character.Humanoid.MaxHealth = health
        wait(0.3)
        player.Character.Humanoid.Health = health
        end

    end
end

Players.PlayerAdded:Connect(onPlayerAdded)

Answer this question