This is my code that clones a tool, and puts it in the player's backpack if they own a gamepass. Here it is m8s:
local passID = 695948228 local gamepass = game:GetService("GamePassService") game.Players.PlayerAdded:connect(function(player, passID) if gamepass:PlayerHasPass(passID) then print(player.Name.. " owns the gamepass with the id of " ..passID) game.ServerStorage.LaserShotGun:Clone(player.Backpack) end end)
The PlayerHasPass()
method, requires two arguments. the Player and the GamePass ID
Therefore, the fixed script would be
local passID = 695948228 local gamepass = game:GetService("GamePassService") game.Players.PlayerAdded:connect(function(player) if gamepass:PlayerHasPass(player, passID) then -- invokes method with both required arguments print(player.Name.. " owns the gamepass with the id of " ..passID) game.ServerStorage.LaserShotGun:Clone().Parent = player.Backpack -- like CootKitty said, the Clone() method doesn't have any arguments end end)
You're over-righting the variable in the function to nil.
Also, Clone doesn't take arguments. You have to set the parent yourself.
local passID = 695948228 local gamepass = game:GetService("GamePassService") game.Players.PlayerAdded:connect(function(player) -- removed variable if gamepass:PlayerHasPass(passID) then print(player.Name.. " owns the gamepass with the id of " ..passID) game.ServerStorage.LaserShotGun:Clone().Parent = player.Backpack -- changed end end)