ok, so, i wanted to create a roblox script that would make the camera work like the one seen in baldi’s basics, so you can’t look up and down, and when the space is held the character looks back, and all of that works perfectly in the studio, except for when you launch it in roblox, the cursor in the menus will be stuck, and even if you launch the game through the menu somehow, the camera will be at the 0,0,0 position instead of the normal one, and what’s even weirder, all of that happens only when you launch the game from the site, when you launch the game from the roblox client everything works
so yeah i don’t know what to do, here’s the script
local camera = workspace.CurrentCamera
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local isSpacePressed = false
local player = game:GetService("Players").LocalPlayer
local playerScripts = player:WaitForChild("PlayerScripts")
local playerModule = require(playerScripts:WaitForChild("PlayerModule"))
local movementController = playerModule:GetControls()
camera.CameraType = Enum.CameraType.Scriptable
local sensitivity = workspace.GlobalValues.Sensitivity
local function updateCamera()
local delta = userInputService:GetMouseDelta()
local rotation = CFrame.Angles(0, math.rad(-delta.x * sensitivity.Value), 0)
local currentRotation = camera.CFrame - camera.CFrame.Position
local newRotation = rotation * currentRotation
local newLookVector = newRotation.LookVector * Vector3.new(1, 0, 1)
camera.CFrame = CFrame.new(camera.CFrame.Position, camera.CFrame.Position + newLookVector)
end
local function onInputBegan(input, processed)
if not processed and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Space then
movementController.moveFunction = function(player, direction, relative)
player.Move(player, -direction, relative)
end
camera.CFrame = CFrame.new(camera.CFrame.Position, camera.CFrame.Position - camera.CFrame.LookVector * Vector3.new(1, 0, 1))
end
end
local function onInputEnded(input, processed)
if not processed and input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Space then
movementController.moveFunction = function(player, direction, relative)
player.Move(player, direction, relative)
end
camera.CFrame = CFrame.new(camera.CFrame.Position, camera.CFrame.Position - camera.CFrame.LookVector * Vector3.new(1, 0, 1))
end
end
userInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
userInputService.InputBegan:Connect(onInputBegan)
userInputService.InputEnded:Connect(onInputEnded)
runService.RenderStepped:Connect(updateCamera)