Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this gamepass script not actually giving the weapon to my players?

It seems so simple im not sure whats going wrong here, no errors or anything.

local id = 103728213
local tool = game.ServerStorage.Guns.Gamepass["MP40"]
 
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
        tool:clone().Parent = player.Backpack
        tool:clone().Parent = player.StarterGear
        else
    end
end)

5 comments

1

Stop using PlayerHasPass, use UserOwnsGamePassAsync

0

Use; game:GetService("MarketPlaceService"):UserOwnsGamePassAsync()

0

Yeah even with those changes its still not working

0

You want a instant change?

0

if is how i do think, then see this, i think this can help you; https://www.robloxdev.com/articles/Game-Passes-One-Time-Purchases

1 answer

local id = 103728213
local tool = game.ServerStorage.Guns.Gamepass["MP40"]

game.Players.PlayerAdded:connect(function(player)
	if game:GetService("GamePassService"):PlayerHasPass(player, id) then
		local clonedtool = tool:Clone()
		clonedtool.Parent = player.Character.Backpack -- if backpack is in local player's model
		local clonedtool = tool:Clone() -- if you want to clone it twice
		clonedtool.Parent = Player.StarterGear
		else
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.