Hello,
I am creating a maze in one of my games and I would like it if players weren't able to zoom out whilst doing it to cheat their way to the finish.
I took some code from an old post on here about limiting the camera zoom distance; https://scriptinghelpers.org/questions/44213/
I'm not sure if the code is outdated or if something else is wrong with my script, but any help would be hugely appreciated :)
local PlayerDebounce = {}
script.Parent.Touched:connect(function(hit)
wait()
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if humanoid and not PlayerDebounce[hit.Parent] then
PlayerDebounce[hit.Parent] = true
wait(0.2)
game:GetService("Players").LocalPlayer.CameraMaxZoomDistance = 1
game:GetService("Players").LocalPlayer.CameraMinZoomDistance = 1
wait(0.5)
PlayerDebounce[hit.Parent] = nil
end
end)
