So basicly, I am trying to make a food that gives you health when you click.
local amount2eat = script.Parent.Settings.TimesCanEat.Value -- something that only lets a player eat it 2 times (IntValue)
local healthGiven = script.Parent.Settings.HealthGivenEachTimeAten.Value
local tool = script.Parent
if amount2eat == 0 then
tool:Destroy() -- if they eat it twice, it goes away.
end
local human = tool.Parent:FindFirstChild("Humanoid") --I set a varible to 'human' to make it easy to code
script.Parent.Activated:Connect(function() --I try giving the player health when they click it, and lower the amount of eats they have/
wait(3)
amount2eat -= 1
human.Health += healthGiven
end)
Any help will be great.

1 comment
So where is the script and is this the entire code?