I'm trying to make a FOV script and I've ran into a problem but I'm not sure what it is?
Asked by
3 years ago Edited 3 years ago
Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
local cPart = script.Parent
local cDetector = script.Parent.FovDetector
local function onFovEnter(player)
script.Parent.see:Play()
end
local function onFovLeave(player) --
script.Parent.Parent.ParticleEffect.SmokeEffect.Enabled = false
local h = player.character:findFirstChild("Humanoid")
h.Health = 0 -- kill the player
local Pos = player.character:findFirstChild("Head")
script.Parent:moveTo(Pos.Position)
script.Parent.saw:Play()
wait(2)
script.Parent.Parent.ParticleEffect.SmokeEffect.Enabled = false
end
cDetector.FovEnter:connect(onFovEnter())
cDetector.FovLeave:connect(onFovLeave())