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

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

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)

1 comment

0

What kind of script is this in?

1 answer

✓ Accepted answer

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.

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