I'm making a script for my gamepass, but i'm stuck now! I don't know how to clone something into a players backpack and make it stay there permanently.
What i've got so far
local passId = 198893078 -- change this to your game pass ID. function isAuthenticated(player) -- checks to see if the player owns your pass return game:GetService("GamePassService"):PlayerHasPass(player, passId) end game.Players.PlayerAdded:connect(function(plr) if isAuthenticated(plr) then print(plr.Name .. " has bought the game pass with id " .. passId) end end)
Here you can use this script:
local GamePassID = 197848488 --game pass ID local Tools = {'ShieldSphere'} --Put the tools names here. (Tools must be held in the lighting of your game) local gps = Game:GetService("GamePassService") function playerJoined(newPlayer) if gps:PlayerHasPass(newPlayer,GamePassID) then for i,v in ipairs (Game.Lighting:GetChildren()) do for a,c in pairs (Tools) do if v.Name:lower()==c:lower() and v:IsA'Tool' then repeat wait() until newPlayer:FindFirstChild("Backpack") and newPlayer:FindFirstChild("StarterGear") v:Clone().Parent = newPlayer.StarterGear v:Clone().Parent = newPlayer.Backpack end end end end end Game.Players.PlayerAdded:connect(playerJoined)
Or will this work?
local passId = 198893078 -- change this to your game pass ID. function isAuthenticated(player) -- checks to see if the player owns your pass return game:GetService("GamePassService"):PlayerHasPass(player, passId) end game.Players.PlayerAdded:connect(function(plr) if isAuthenticated(plr) then local sord = game.ReplicatedStorage.ITEMS.GamepassSword print(plr.Name .. " has bought the game pass with id " .. passId) sord:Clone(plr.Backpack) end end)