function hi(x) local y = x.Backpack local z = game.Lighting["Dragon Slayer"] z:Clone().Parent = y -- then put your item in lightning. end script.Parent.ClickDetector.MouseClick:connect(hi)
So this is my code above... how would I fix this so that if the tool that is being given is already in the person inventory not be given otherwise if they don't have the tool it will be given?
```lua function hi(Plr) local Lighting = game:GetService("Lighting") local Backpack = Plr.Backpack local DS = Lighting["Dragon Slayer"]:Clone() DS.Parent = Backpack end
script.Parent.ClickDetector.MouseClick:Connect(hi(Player)) ```
You should use "if statements"
local z = game.Lighting["Dragon Slayer"] if x.BackPack:FindFirstChild(z) then print("has") end else z:Clone().Parent = x.BackPack end