Okay so, i'm doing a machine that when the player uses it with a tool equipped it removes the tool and give the user a new one in exchange, here is the code:
function Triggered2(Player)
local backpack = Player.Backpack
local char = Player.Character
local tool = char:FindFirstChildOfClass("Tool")
print(tool)
if DB2 == false then
DB2 = true
if value.Value == 0 then
if tool ~= nil then
print("code works till here")
if tool=="[SCP] Card-L5" then
print("got if")
tool:Destroy()
local card = folder:FindFirstChild("Plastic Card")
local card2 = card:Clone()
card2.Parent = backpack
else print("if is false")
end
end
end
DB = false
end
end
Here's the prints
14:49:53.313 [SCP] Card-L5 - Server - Main:40
14:49:53.314 code works till here - Server - Main:45
14:49:53.314 if is false - Server - Main:56
I already tried converting to string, changing the card name, i tried a lot of things and nothing worked so i'm here to see if someone got a solution for me

1 comment
that was it! Thank you!