local x_rotation_clamp = math.pi/2 - 0.01
local UIS = game:GetService(“UserInputService”)
local playerGui = player.PlayerGui
local folder = Instance.new(“Folder”)
folder.Name = “CameraGui”
folder.Parent = playerGui
local screenGui = Instance.new(“ScreenGui”)
screenGui.Name = “CameraGui”
screenGui.Parent = folder
local mouseFrame = Instance.new(“Frame”)
mouseFrame.Position = UDim2.new(0, 0, 0.5, 0)
mouseFrame.Size = UDim2.new(0, 0, 0, 0)
mouseFrame.Parent = screenGui
mouse.Icon = “”
mouse.KeyDown:connect(function(key)
if key == “v” then
if mouseFrame.Visible then
mouseFrame.Visible = false
else
mouseFrame.Visible = true
end
end
end)
local move_speed = 50
local y_rotation = 0
local y_rotation_change = 0
local x_rotation = 0
local x_rotation_change = 0
camera.CameraType = Enum.CameraType.Custom
camera.CFrame = CFrame.new(0, 0, 0)
local body_cframe = camera.CFrame
local body_cframe_change = CFrame.new(0, 0, 0)
UIS.InputBegan:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
mouseFrame.Position = UDim2.new(0, input.Position.X, 0, input.Position.Y)
end
end)
UIS.InputChanged:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
y_rotation_change = input.Delta.y/100
x_rotation_change = input.Delta.x/100
end
end)
UIS.InputEnded:connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
y_rotation_change = 0
x_rotation_change = 0
end
end)
local move_vector = Vector3.new(0, 0, 0)
local move_vector_change = Vector3.new(0, 0, 0)
UIS.InputBegan:connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
move_vector_change = Vector3.new(0, 0, -1)
elseif input.KeyCode == Enum.KeyCode.S then
move_vector_change = Vector3.new(0, 0, 1)
elseif input.KeyCode == Enum.KeyCode.A then
move_vector_change = Vector3.new(-1, 0, 0)
elseif input.KeyCode == Enum.KeyCode.D then
move_vector_change = Vector3.new(1, 0, 0)
end
end
end)
UIS.InputEnded:connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
move_vector_change = move_vector_change - Vector3.new(0, 0, -1)
elseif input.KeyCode == Enum.KeyCode.S then
move_vector_change = move_vector_change - Vector3.new(0, 0, 1)
elseif input.KeyCode == Enum.KeyCode.A then
move_vector_change = move_vector_change - Vector3.new(-1, 0, 0)
elseif input.KeyCode == Enum.KeyCode.D then
move_vector_change = move_vector_change - Vector3.new(1