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

How can I make an npc drop something properly?

Asked by 5 years ago

I have an npc, which drops meat when killed. That works fine, but the meat is supposed to increase a value and then destroy itself, but it does none of those. How can i fix this? Here is my give value script:


local ting = 0 --debouncer function onTouched(hit) if ting == 0 then ting = 1 check = hit.Parent:FindFirstChild("Humanoid") if check ~= nil then local user = game.Players:GetPlayerFromCharacter(hit.Parent) local stats = user:findFirstChild("MeatFolder") if stats ~= nil then local cash = stats:findFirstChild("Beef") cash.Value = cash.Value + 1 script.Parent:Remove() wait(2) end end ting = 0 end end script.Parent.Touched:connect(onTouched)
0
What is it doing wrong? DragRacer31 7 — 5y
0
It doesn't go away and it doesn't give the value. It prints an error involving the user. CaptainD_veloper 290 — 5y

Answer this question