Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Player looks at something to cause an event?

How would I be able to make an event happen if a player were to look at something? An example would be like a player looking at a picture that causes their vision to blur, etc.. Would this deal with LookVectors or something?

1 comment

0

possibly. My best guess is to have a LocalScript check the camera's position every time it changes, calculate what is inside the field of view, and if the thing you are trying to get is, then fire a BindableEvent.

1 answer

Yes, ClickDetectors have an event that triggers when the mouse is hovered over the object.

local Click = -- your ClickDetector --

function Click.MouseHoverEnter:Connect(function()
	-- Your Code when the player is looking at it --
end)

function Click.MouseHoverLeave:Connect(function()
	-- Your Code when the player looks away from it --
end)

1 comment

0

no, gamemaster does not want an event to fire when the player hovers their mouse over something. he/she wants to fire and event when a certain part comes into their field of view - simply when they see it.

This discussion is preserved as it was. New answers, comments, and votes are closed.