Im trying to make the part that the character is touching disapear but instead the character is killed when i do this.
This is the script
food = Instance.new("Part", game.workspace.foodlist) food.Touched:connect(function(food) _G.score.Value = _G.score.Value + 1 food:Destroy() end)
It's probably best not to put "food" as the parameter of the function as you have already used it on line 1. It may cause confusion as to what is what.
local food = Instance.new("Part", game.workspace.foodlist) food.Touched:connect(function(hit) _G.score.Value = _G.score.Value + 1 food:Destroy() end)
Does that work?