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

[SOLVED] Why wont this gamepass give the player the weapon when they join the game?

Asked by 3 years ago
Edited 3 years ago

So i made this gamepass thats supposed to give the player a weapon when the buy it and if the already have it and they have the weapon its suppoesd to not give them one but even if they dont have the weapon and have the gamepass it still doesnt give them a weapon can some body pls help me

local MPS = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local GamePassID = 9869510

function PSpawn(player)
    local plrhaspass = false
    plrhaspass = MPS:UserOwnsGamePassAsync(player.userId, GamePassID)

    if plrhaspass == true then
local back = player.Backpack
if back["Water Scythe"] ~= nil then return 
else
        game.Lighting.VipGui:Clone().Parent = player.Character.Head  
        game.Lighting["Water Scythe"]:Clone().Parent = player.Backpack
        game.Lighting["Water Scythe"]:Clone().Parent = player.StarterGear
        player.leaderstats.Exp.Value = player.leaderstats.Exp.Value + 0
end
end
end



game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function()
        PSpawn(player)
    end)
end)
0
What kind of script is this in? AntiWorldliness 868 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

This is off of a youtube video, I just happened to have the script on hand.

local MarketPlaceService = game:GetService("MarketplaceService") --//MarketPlaceService
local id = 9869510 --//Your id here

game.Players.PlayerAdded:Connect(function(player)   
    if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, id) then
        game.ReplicatedStorage.Tool:Clone().Parent = player.BackPack --//Place your gear into replicated storage instead of lighting lol.
        game.ReplicatedStorage.Tool:Clone().Parent = player.StarterGear
    end
end)

Should do the job. Let me know if you have any problems.

Ad

Answer this question