my code:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local function pickup(key) if key == "f" then game.Players[player.Name]:WaitForChild("Hunger").Value = game.Players[player.Name]:WaitForChild("Hunger").Value -5 script.Parent:Remove() end end mouse.KeyDown:connect(pickup)
I only want this to be able to activate when the player is standing near and is looking at the item, how would I do that? thanks