Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How do i make it so if you look at something youll die?

Asked by 2 years ago

i've gotten inspired by the haunted staircase and the 2nd monster if you look at it behind you you die how can i do this? i dont see any tutorials on youtube

2 answers

Log in to vote
0
Answered by 2 years ago
deathPart = part  -- Pass there your part, that part if you place cursor on it you will die.

local plr = game.Players.LocalPlayer -- define localplayer

local mouse = plr:GetMouse() -- get player's mouse

while wait() do -- make infinite checking loop
    if mouse.Target == deathPart then  -- if player cursor is placed on deathPart. Make them watch from first person or make invisible or barely visible part across whole area you want them to die when they look there.
        plr.Character.Humanoid.Health = 0 -- kill player
    end
end
0
aren't they talking about looking at it and not the mouse hovering over it? Gmorcad12345 434 — 2y
0
YEAH momgggbghghghghg 50 — 2y
0
but i think this works too momgggbghghghghg 50 — 2y
Ad
Log in to vote
1
Answered by
Xapelize 2658 Moderation Voter Community Moderator
2 years ago

https://developer.roblox.com/en-us/api-reference/function/Camera/WorldToScreenPoint

that one might help, i wont help everything but try to do it

Answer this question