My game involves an element that needs to call a function when the player sees a part. Is there any way to do this nicely, or do i need to make a physical part representing the player's FOV?
An ideal solution:
game.Players.LocalPlayer.Character.Humanoid:OnSight(game.Workspace.ScaryPart):Connect(function()
CustomKillFunction()
end)
Please excuse me if this is a stupid question, im new to Roblox development.

2 comments
That code wouldn't even run the first line since character isn't defined. Unless, you put this in StarterCharacterScripts
CustomKillFunction is not defined in this script so another error will occur, along with :OnSight