My game has cutscenes in them a lot, and sometimes this bug will happen where it will fly off into the void. It also makes my character act like it has shift lock on, when it was never turned on, and never has been turned on.
I do have mobile shift lock, would that have something to do with it? I am not sure if that would effect the cutscenes in anyway.
Here is a clip of the bug:
Here is what is supposed to happen:
If you can help me know what’s going on, it would be a big help. Thanks!
We can’t really help you with your games scripting if you don’t provide the code that manipulates the camera. You should try isolating the problem in a separate place using only the minimum features necessary to reproduce the issue.
game.ReplicatedStorage.ElevatorView.OnClientEvent:Connect(function(show)
local mobile = game.Players.LocalPlayer.PlayerGui.ShiftlockMobile
if show == true then
mobile.LocalScript.Disabled = true
mobile.ImageButton.ShiftGUI.Disabled = true
game.Workspace.CurrentCamera.CameraType = "Scriptable"
game.Workspace.CurrentCamera.CFrame = game.Workspace.Lobby.GameFunction.ElevatorTeleport.CFrame
else
local TS = game:GetService("TweenService")
local info = TweenInfo.new(2.75, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
game.Players.LocalPlayer.PlayerGui.Transition.Frame.Position = UDim2.new(0,0,1.4,0)
TS:Create(game.Players.LocalPlayer.PlayerGui.Transition.Frame, info, {Position = UDim2.new(0,0,-1.4,0)}):Play()
wait(.9)
game.Workspace.CurrentCamera.CameraType = "Custom"
game.Workspace.CurrentCamera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
mobile.LocalScript.Disabled = false
mobile.ImageButton.ShiftGUI.Disabled = false
end
end)
That is my code. I have multiple different cutscenes that basically use this same code, and it does the same glitch.
This is the mobile shift lock script I use:
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local Settings = UserSettings()
local GameSettings = Settings.GameSettings
local ShiftLockController = {}
while not Players.LocalPlayer do
task.wait()
end
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local ScreenGui, ShiftLockIcon, InputCn
local IsShiftLockMode = true
local IsShiftLocked = true
local IsActionBound = false
local IsInFirstPerson = false
ShiftLockController.OnShiftLockToggled = Instance.new("BindableEvent")
local function isShiftLockMode()
return LocalPlayer.DevEnableMouseLock and GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch and LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.ClickToMove and GameSettings.ComputerMovementMode ~= Enum.ComputerMovementMode.ClickToMove and LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.Scriptable
end
if not UserInputService.TouchEnabled then
IsShiftLockMode = isShiftLockMode()
end
local function onShiftLockToggled()
IsShiftLocked = not IsShiftLocked
ShiftLockController.OnShiftLockToggled:Fire()
end
local initialize = function()
end
function ShiftLockController:IsShiftLocked()
return IsShiftLockMode and IsShiftLocked
end
function ShiftLockController:SetIsInFirstPerson(isInFirstPerson)
IsInFirstPerson = isInFirstPerson
end
local function mouseLockSwitchFunc(actionName, inputState, inputObject)
if IsShiftLockMode then
onShiftLockToggled()
end
end
local function disableShiftLock()
if ScreenGui then
ScreenGui.Parent = nil
end
IsShiftLockMode = false
Mouse.Icon = ""
if InputCn then
InputCn:disconnect()
InputCn = nil
end
IsActionBound = false
ShiftLockController.OnShiftLockToggled:Fire()
end
local onShiftInputBegan = function(inputObject, isProcessed)
if isProcessed then
return
end
if inputObject.UserInputType ~= Enum.UserInputType.Keyboard or inputObject.KeyCode == Enum.KeyCode.LeftShift or inputObject.KeyCode == Enum.KeyCode.RightShift then
end
end
local function enableShiftLock()
IsShiftLockMode = isShiftLockMode()
if IsShiftLockMode then
if ScreenGui then
ScreenGui.Parent = PlayerGui
end
if IsShiftLocked then
ShiftLockController.OnShiftLockToggled:Fire()
end
if not IsActionBound then
InputCn = UserInputService.InputBegan:connect(onShiftInputBegan)
IsActionBound = true
end
end
end
GameSettings.Changed:connect(function(property)
if property == "ControlMode" then
if GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch then
enableShiftLock()
else
disableShiftLock()
end
elseif property == "ComputerMovementMode" then
if GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove then
disableShiftLock()
else
enableShiftLock()
end
end
end)
LocalPlayer.Changed:connect(function(property)
if property == "DevEnableMouseLock" then
if LocalPlayer.DevEnableMouseLock then
enableShiftLock()
else
disableShiftLock()
end
elseif property == "DevComputerMovementMode" then
if LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.ClickToMove or LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable then
disableShiftLock()
else
enableShiftLock()
end
end
end)
LocalPlayer.CharacterAdded:connect(function(character)
if not UserInputService.TouchEnabled then
initialize()
end
end)
if not UserInputService.TouchEnabled then
initialize()
if isShiftLockMode() then
InputCn = UserInputService.InputBegan:connect(onShiftInputBegan)
IsActionBound = true
end
end
enableShiftLock()
return ShiftLockController