i'm making a Gui shop and i'm trying to find an accessory inside the players character that equals the Equipped Value and Deletes it.
the script is a global script in ServerScriptService.
iv'e looked at it for a long time and can't seem to find the issue.
game.ReplicatedStorage:WaitForChild("CreateTransactionBag").OnServerInvoke = function(player,Item) --this is the triggering function when the players clicked the buy button
--CreatTransactionBag is a RemoteFunction
local gold = game.Players:FindFirstChild(player.Name).leaderstats.Gold
local cost = game.ServerStorage.ShopFolder.BagShop.ItemModels[Item].Information.Cost
local Class = game.ServerStorage.ShopFolder.BagShop.ItemModels[Item].Information.Class
print(gold.Value)
print(cost.Value)
if gold.Value >= cost.Value and not game.ServerStorage.PlayerStuff[player.Name].Bags:FindFirstChild(Item) then
print ("Test1")--prints in testing
gold.Value = gold.Value-cost.Value
print(player.HidenStats.EquipedTool.Value)--this is the Equipped Value's location
for i, v in pairs(player.Character:GetChildren())do
if v.Name == player.HidenStats.EquipedTool.Value then --broken part
v:Destroy()
print ("Test2")--dosen't print in testing
end
end

3 comments
do you mean the output cause there are no errors
What type of Value is EquipedTool?
String