I am making a fishing simulator where you get your fish in your inventory, but it won't delete my fish when I touch my sell part, and nor will it give me money(Coins) Btw this is a local script in my sell part.
Here is my code:
local plr = game.Players.LocalPlayer local plrBackpack = plr.Backpack local part = script.Parent part.Touched:Connect(function(hit) local coinsValue = plr.leaderstats.Coins.Value if not hit:IsDescendantOf(plr.Character) then return end for _, Fish in pairs(plrBackpack:GetChildren()) do if Fish.Name == 'Faceless fish' then Fish:Destroy() coinsValue += 5 end end end)
Local scripts do not run in Workspace.
Also, you should not be handling coins on the client.