Hello everyone,
I have this script:
local camera = workspace.Camera
local player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Z then
player.CameraMode = Enum.CameraMode.Classic
camera.FieldOfView = 15
end
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Z then
player.CameraMode = Enum.CameraMode.Classic
camera.FieldOfView = 35
end
end)
What it does is: when a player presses the “Z” key, it zooms into the character, and when the player stops pressing it the FOV returns to normal.
How can I make this into a button for mobile and therefore have the same effect? (the player presses a GUI button and then when the player stops pressing it the same thing happens as the PC one)
Thanks in advance.