for _,food in pairs(game.Workspace:WaitForChild("Holder"):GetChildren()) do
food.Touched:connect(function(hit)
local other = hit.Parent:findFirstChild("Food")
local player = hit.Parent:findFirstChild("Humanoid")
if other ~= nil then
other:Remove()
elseif player ~= nil then
local plr = player.Parent
food:Destroy()
local getValue = game.Players[plr.Name]:WaitForChild("FoodAmount")
getValue.Value = getValue.Value + 1
end
end)
end
COMMUNITY QUESTION
Why won't this script work?
1 answer
Check if there is anything missing. Also, try using game.Players:getPlayerFromCharacter(plr)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
for what? that just gives you the player model
Well, there is nothing wrong with that script. There might be something missing however.