In my game the player starts out in a load out screen and their camera is locked onto a part’s CFrame. When they click play I want them to teleport, have their camera reset to normal, give them the ability to move (give them WalkSpeed and JumpPower), and disable the UI.
It all works correctly except when you’re on VR. It makes the player not able to walk or jump even though the script runs and the UI gets disabled which is the last line excluding the closing line.
At first I had the camera lock onto the player’s head but that broke the camera on VR and locked it into the head’s original position and didn’t follow it. Now I have it follow the player’s Humanoid but the player can’t move.
The play button script:
-- (local script in image button)
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
plr.Character.Torso.CFrame = workspace.TelepartT.CFrame
workspace.Camera.CameraType = "Custom"
workspace.Camera.CFrame = plr.Character.Head.CFrame
workspace.Camera.CameraSubject = plr.Character.Humanoid
plr.Character.Humanoid.WalkSpeed = 36
plr.Character.Humanoid.JumpPower = 45
script.Parent.Parent.Parent.Enabled = false
end)
Also the script that brings the player to the loadout screen:
-- (local script inside of StarterCharacterScripts)
local Player = game.Players.LocalPlayer
local Cam = workspace.CurrentCamera
local MenuCamPoints = workspace.UICam
Cam.CameraType = Enum.CameraType.Scriptable
Cam.CFrame = MenuCamPoints.CFrame
Player.Character.Humanoid.WalkSpeed = 0
Player.Character.Humanoid.JumpPower = 0