My code is. This is located in a LocalScript within a textbutton, located in StarterGui
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local camera = workspace.CurrentCamera
local cameraPart = workspace.CameraPart
local function updateCameraCFRAME()
camera.CFrame = cameraPart.CFrame
end
UIS.InputBegan:Wait()
if UIS.KeyboardEnabled then
RS.RenderStepped:Connect(updateCameraCFRAME)
script.Parent.MouseButton1Click:Connect(function()
print("TextButton was MouseButton1Click")
camera.CameraType=Enum.CameraType.Custom
end)
end
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local camera = workspace.CurrentCamera
local cameraPart = game.Workspace.CameraPart
local function updateCameraCFRAME()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = cameraPart.CFrame
camera.CameraSubject = cameraPart
end
UIS.InputBegan:Wait()
if UIS.KeyboardEnabled then
RS.RenderStepped:Connect(updateCameraCFRAME)
script.Parent.MouseButton1Click:Connect(function()
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = game.Players.LocalPlayer:WaitForChild("Humanoid")
end)
end
I think the UserInputStuff is right, as it only happens when its on a keyboard input, which is what I want. It sets the camera, it just won’t set it back to costum when the button is clicked.
it sets the camera after keyboard input, but then when I press the button, nothing happens, when it should set the camera to costum again.