So, how would I make the player take damage when looking at an object?
I am trying to make a stop it slender game and I am trying to make the player take damage when looking at him. I can use :ModelPrimaryPart() or whatever it was (I don't know) but other than that I can't really understand how to do it.
So Make A Local Script Then Place The Local Script In Starter Pack then Copy This :
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local damage = 10 local run = game:GetService("RunService") local timebeforeotherdamage = 0.5 -- the time you want between every damage repeat wait() until player.Character local char = player.Character local humanoid = char:WaitForChild("Humanoid") run.RenderStepped:Connect(function() if mouse.Target == game.Workspace.Part then -- replace the part with slender. humanoid:TakeDamage(1) wait(timebeforeotherdamage) end end)
If This Worked Then Please Accept This As an Answer That Would Help Me,
Hope This Helps! If You Want An Explanation then feel free to respond to me!