Skip to content

Top-down camera game example.

Latest

Choose a tag to compare

@Dynamic155 Dynamic155 released this 01 Jun 13:51
· 2 commits to main since this release
ea05fe8

Release:

This game attached includes a simple 2-stage obby.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local mouse = player:GetMouse()

local function updateCharacterRotation()
	local mousePosition = mouse.Hit.p
	local direction = (mousePosition - humanoidRootPart.Position).Unit
	direction = Vector3.new(direction.X, 0, direction.Z)
	local lookAt = CFrame.new(humanoidRootPart.Position, humanoidRootPart.Position + direction)
	humanoidRootPart.CFrame = lookAt
end

RunService.RenderStepped:Connect(updateCharacterRotation)

The script above makes the character rotate to look towards the mouse for an interesting effect. It's not the best, however it works just fine. If you have any issues make sure to read the readme to see hot to contribute.