I have a game pass in my game that gives you a tool, but it doesn't work unless you backspace it and pick it back up. Any way to fix this?
Error: Handle is not a valid member of Tool
No errors with Tool script
Once backspaced it works fine
local function WaitForChild(parent, childName) assert(parent, "ERROR: WaitForChild: parent is nil") while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end local GamePassService = game:GetService('GamePassService') local PlayersService = game:GetService('Players') local InsertService = game:GetService('InsertService') local LightingService = game:GetService('Lighting') local GamePassIdObject = WaitForChild(script, 'GamePassId') local ToolAssetsToLoad = WaitForChild(script, 'ToolAssetsToLoad') local AdminTools = LightingService:FindFirstChild('AdminTools') local function CloneAdminTools(target) for _, tool in pairs(AdminTools:GetChildren()) do local toolClone = tool:Clone() toolClone.Parent = target end end local function OnPlayerAdded(player) if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then local starterGear = WaitForChild(player, 'StarterGear') CloneAdminTools(starterGear) if player.Character then local backpack = WaitForChild(player, 'Backpack') CloneAdminTools(backpack) end end end if not AdminTools then AdminTools = Instance.new('Model') AdminTools.Name = 'AdminTools' for _, intObject in pairs(ToolAssetsToLoad:GetChildren()) do if intObject and intObject:IsA('IntValue') and intObject.Value then local assetModel = InsertService:LoadAsset(intObject.Value) if assetModel then local asset = assetModel:GetChildren()[1] if asset then asset.Parent = AdminTools end end end end AdminTools.Parent = LightingService end PlayersService.PlayerAdded:connect(OnPlayerAdded)
Sorry mate, but that script is fine... It's the tool that is messed up.... Hope I saved you time.