local tools = {"Demisting Blast", "Obscurring Clouds", "Rising Scorching Sun", "Sixfold", "Thunder Clap And Flash", "Unknowing Fire"} local WaterWheel = game.ReplicatedStorage.Tools["Water Wheel"] local function checkTool(player) local backpack = player.Backpack for i,v in pairs(backpack:GetChildren()) do if table.find(tools,1,v.Name) then return end WaterWheel:Clone().Parent = backpack end end script.Parent.MouseClick:Connect(function() checkTool() end)
I want to make it detect a certain item and give you a different item but I dont know how to make it work.
local tools = {"Demisting Blast", "Obscurring Clouds", "Rising Scorching Sun", "Sixfold", "Thunder Clap And Flash", "Unknowing Fire"} local WaterWheel = game.ReplicatedStorage.Tools["Water Wheel"] local function checkTool(player) local backpack = player.Backpack for i,v in pairs(backpack:GetChildren()) do if table.find(tools,i,v.Name) then return end local newtool = WaterWheel:Clone() newtool.Parent = backpack end script.Parent.MouseClick:Connect(function() checkTool() end)
Hopefully this should work.
local twool = game.ReplicatedStorage.SecondTool:Clone() local tool = player.Backpack:FindFirstChild("FirstTool") --You must use findFirstChild here otherwise it can error if it can't find it if tool then --If the tool exists twool.Parent = player.Backpack --Place the clone in the Backpack tool:Destroy --Destroy the old tool end
I'm not the best at scripting, but I assume this should work