I have a script that sends a tool to the players backpack after clicking on it.

local serverStorage = game:GetService("ServerStorage")
local tool = serverStorage:FindFirstChild("tools").redkeytool
local tool2 = serverStorage
local tool3 = tool2:FindFirstChild("goldkey"):Clone()
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
	    if plr.Character:FindFirstChild("Humanoid").Health > 0 then
			if plr.Backpack:FindFirstChild("redkeytool") or plr.Character:FindFirstChild("redkeytool") then
				if tool3.Parent ~= game.Workspace then
					tool3.Parent = game.Workspace
					tool3.CFrame = game.Workspace.redkey.CFrame
					game.Workspace.goldkey:Destroy()
				end
			end
        if not plr.Backpack:FindFirstChild("redkeytool") and not plr.Character:FindFirstChild("redkeytool") then
             for i, v in pairs(plr.Backpack:GetChildren())do
                if v.Name ~= "keyid" then
                    v:Destroy()
                end
             end    
            local clonedTool = tool:Clone()
            clonedTool.Parent = plr.Backpack
        end
    end
end)

It basically checks if a player is holding a red key, and then when the click the item (gold key), it "drops" the red key in the same place where the gold key is, destroys the gold key, and gives the player a gold key

I have many other keys (orange, for example) and I dont want to make if statements for each one. Is there an easier way?