i have this script here that i pieced together and i was wondering 2 things. 1, this is a script that detects a gamepass and gives an item, but if the user does not have the gamepass it gives a different item, would that be the expected function of this script? 2. will it work correctly? heres the script from start to finish:
local GamePassService = Game:GetService('GamePassService') local passid = 271014729 -- The ID of the gamepass goes here local tools = {"Oblivion"} -- Here you just put the name(s) of the tool(s) you want given. game.Players.PlayerAdded:connect(function(player) repeat wait(0.1) until player.Backpack repeat wait(0.1) until player.StarterGear if GamePassService:PlayerHasPass(player, passid) then for i = 1,#tools do game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear if not GamePassService:PlayerHasPass(player, passid) then Player=script.Parent.Parent.Parent.Parent.Parent script.Parent.Text=tostring(script.Parent.ItemName.Value)..": "..tonumber(script.Parent.Cost.Value).." "..tostring(script.Parent.Currency.Value) script.Parent.MouseButton1Click:connect(function() if Player:findFirstChild("leaderstats") then if Player.leaderstats[script.Parent.Currency.Value].Value>=tonumber(script.Parent.Cost.Value) then Player.leaderstats[script.Parent.Currency.Value].Value=Player.leaderstats[script.Parent.Currency.Value].Value-tonumber(script.Parent.Cost.Value) game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.Backpack game.Lighting[script.Parent.ItemName.Value]:Clone().Parent=Player.StarterGear end end end) end end end end)
thanks.

1 comment
Please place your code in a code block.