Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My items won't destroy and i don't get any money, how do I do?

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)

1 answer

Local scripts do not run in Workspace.

Also, you should not be handling coins on the client.

1 comment

0

That doesn't really help me, but I did not know the thing about local scripts

This discussion is preserved as it was. New answers, comments, and votes are closed.