Hello, I’m using an FOV script which I’ve slightly modified to rely on a remote event so a touched event can trigger it more easily.
The FOV script works perfect in studio, however when I’m testing in a live environment it just doesn’t work. It prints my print aswell, but the players FOV doesn’t change nor does their walkspeed.
Added a print to see if it would print it.
Set camera FOV to the == check before calling the == check.
Script:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
game.ReplicatedStorage.RemoteEvents.JumpscareFOV.OnClientEvent:Connect(function()
local cam = workspace.CurrentCamera
cam.FieldOfView = 70
print("Fov script called successfully!")
wait()
if cam.FieldOfView == 70 then
local stopFOVamt = 90
while task.wait() do
cam.FieldOfView += 1
if cam.FieldOfView >= stopFOVamt then
cam.FieldOfView = 90
hum.WalkSpeed = 7
break
end
end
wait(4)
local stopFOVamt2 = 70
while task.wait() do
cam.FieldOfView -= 1
if cam.FieldOfView <= stopFOVamt2 then
cam.FieldOfView = 70
hum.WalkSpeed = 16
break
end
end
else
cam.FieldOfView = 70
hum.WalkSpeed = 16
end
end)
Thanks in advance!