Hi, as the Title sais I'm trying to locate 2 tools which are both called "atlas sword" using findFirstChild method. but for some reason it won't work. here's the script:
local player = game.Players.LocalPlayer local l = player.Backpack:findFirstChild("atlas sword") script.Parent.MouseButton1Click:connect(function() if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,277976767) then game.Lighting["atlas sword"]:Clone().Parent = player.Backpack if l then l:Remove() end end end)
Thanks for the Help.
You were making it remove the tool right after it gave the player it, also not sure why the local l = player.Backpack:findFirstChild("atlas sword")
won't work, but here's a script that'll work for what you want. Sorry I can't explain it any better.
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:connect(function() if player.Backpack:FindFirstChild("atlas sword") then player.Backpack["atlas sword"]:Remove() end if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,277976767) then game.Lighting["atlas sword"]:Clone().Parent = player.Backpack end end)