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

PlayerAdded Gamepass Event isn't working. May I get some help?

Asked by 6 years ago
Edited 6 years ago

Script:

local MarketplaceService = game:GetService("MarketplaceService")

local gamePassID = 4564937  -- Change this to your game pass ID

game.Players.PlayerAdded:Connect(function(player)

    local ownsPass = false

    -- Check if the player already owns the game pass
    local success, message = pcall(function()
        ownsPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
    end)

    if ownsPass == true then
        player.CharacterAdded:Connect(function(body)
            local trail = game.ServerStorage.Trail:Clone()
            trail.Parent = body.Head
            local attatch = Instance.new("Attachment", body.Head)
            local attatch1 = Instance.new("Attachment", body.HumanoidRootPart)
            trail.Attachment0 = attatch
            trail.Attachment1 = attatch1
        end)
    end
end)

Serverscript in workspace. Nothing in output, what's wrong? I checked to see if the trail system by itself works, and it does. But it seems like something is wrong with the gamepass check system. Idk. And yes, there's a trail object named "Trail" in serverstorage.

Answer this question