How to recreate Bloxburg-like camera

Hi,

I’ve been trying at this for a couple of hours and i’ve got quite mad about it, so i would like to ask the devForum.

I have been trying to recreate a bloxburg-like camera but my camera is not remotely like bloxburg’s.

Here is the script:

local cam = workspace.CurrentCamera

--player variables
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

repeat wait()
	cam.CameraType = Enum.CameraType.Scriptable
until cam.CameraType == Enum.CameraType.Scriptable

function rotateDelta(NewMousePosition, OldMousePosition)
	local MouseDelta = math.ceil(NewMousePosition - OldMousePosition / 10000)/10
	print(MouseDelta)

	game:GetService("TweenService"):Create(cam, TweenInfo.new(.1, Enum.EasingStyle.Exponential), {CFrame = cam.CFrame * CFrame.Angles(0, math.rad(MouseDelta),0)}):Play()
end
local button2Down = false
local cooldown = false

mouse.Button2Down:Connect(function()
	button2Down = true
	mouse.Move:Connect(function()
		if cooldown == false then
			cooldown = true
			if button2Down == true then
				local position =  mouse.Hit.Z
				wait()
				local positionafter = mouse.Hit.Z

				if mouse.Target then
					rotateDelta(position, positionafter)
				end
				
			end
		end
	end)
	wait()
	cooldown = false
end)

mouse.Button2Up:Connect(function()
	button2Down = false
end)



function button(Key)
	if Key == 'A' then
		cam.CFrame = cam.CFrame * cam.CFrame.RightVector * -1
	elseif Key == 'D' then
		cam.CFrame = cam.CFrame * cam.CFrame.RightVector * 1
	elseif Key == 'W' then
		cam.CFrame = cam.CFrame * cam.CFrame.LookVector * 1
	elseif Key == 'S' then
		cam.CFrame = cam.CFrame * cam.CFrame.LookVector * -1
	end
end


game:GetService("UserInputService").InputBegan:Connect(function(input)
	button(input)
end)

here is what it looks like:

Thanks
Kieran :slight_smile:

1 Like