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

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

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

✓ Accepted answer
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

3 comments

0

aren't they talking about looking at it and not the mouse hovering over it?

0

YEAH

0

but i think this works too

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