Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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:

01local plr = game.Players.LocalPlayer
02 
03local plrBackpack = plr.Backpack
04 
05local part = script.Parent
06 
07part.Touched:Connect(function(hit)
08 
09    local coinsValue = plr.leaderstats.Coins.Value
10 
11    if not hit:IsDescendantOf(plr.Character) then return end
12 
13    for _, Fish in pairs(plrBackpack:GetChildren()) do
14 
15        if Fish.Name == 'Faceless fish' then
View all 23 lines...

1 answer

Log in to vote
0
Answered by 4 years ago

Local scripts do not run in Workspace.

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

0
That doesn't really help me, but I did not know the thing about local scripts Anderssc 22 — 4y
Ad

Answer this question