so i have a script in the workspace in a proximity prompt where when you activate it it changes the camera to a custom camera. For some reason when i tried to use it, it said "attempt to index nil with ‘GetMouse’ "
script.Parent.Triggered:Connect(function()
game.StarterGui.ScreenGui.frame.Visible = true
game.StarterGui.ScreenGui.DayO.Visible = true
wait(2.5)
game.StarterGui.ScreenGui.frame.Visible = false
game.StarterGui.ScreenGui.DayO.Visible = false
game.Lighting.ClockTime = 4
game.Lighting.FogColor = Color3.new(0, 0, 0)
game.Lighting.FogEnd = 300
game.Lighting.Ambient = Color3.new(0.14902, 0.172549, 0.184314)
game.Lighting.OutdoorAmbient = Color3.new(0.14902, 0.172549, 0.184314)
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local run = game:GetService("RunService")
local c = workspace:WaitForChild("cam")
local cam = workspace.CurrentCamera
local maxDegree = math.rad(45)
repeat
cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable
run.RenderStepped:Connect(function()
local mp = Vector2.new(mouse.X, mouse.Y)
local centre = Vector2.new(cam.ViewportSize.X/2,cam.viewportSize.Y/2)
local difference = mp - centre
local outcome = Vector2.new((difference.Y/centre.Y)*maxDegree, (difference.X/centre.X)*maxDegree)
cam.CFrame = CFrame.Angles(-outcome.X, -outcome.Y,0) + c.Position
player.Character.HumanoidRootPart.Position = workspace.sleep.Position
player.Character.Humanoid.WalkSpeed = 0
player.Character.Humanoid.JumpPower = 0
end)
end)