Goal: When the player clicks/activates the food item, it is removed from their inventory.
My setup: This is located in lighting, I have a script so when the player clicks on a part, it clones + enters their inventory.
My script:
Control script below:
local remote = script.EatRemote
script.Parent.Activated:Connect(function()
remote:FireServer("Eat")
end)
Eat script below:
remote.OnServerEvent:Connect(function(Player, value)
local character = workspace:WaitForChild(Player.name)
if value == "Eat" then
script.Parent:Remove()
end
end)