Hello, I am new to the community here. I have been recently been working on a game where I have a sphere that is the player. I made it so that you could view the player from perfect top down. Unfortunately, when I did this the player stopped moving with WASD keys. I noticed that as soon as I change the Vector3 to not point the CFrame all the way down the character moves again but in a diagonal and inverted way.
Here's my code:
print("Intalized Camera Script") local RunService = game:GetService("RunService") local Players = game:GetService("Players") local OFFSET = Vector3.new(0, 400, 0) local FOV = 30 local player = Players.LocalPlayer local camera = game.Workspace.CurrentCamera camera.FieldOfView = FOV local function onRenderStep() local character = player.Character if character then local humanoidRootPart = character:FindFirstChild("HumanoidRootPart") if humanoidRootPart then local playerPos = humanoidRootPart.Position local cameraPos = playerPos + OFFSET camera.CoordinateFrame = CFrame.new(cameraPos, playerPos) end end end RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)
I followed the Roblox Wiki tutorial and modified it to fit my needs. I have been searching for hours for answers. Maybe I am blind and can't read or I am finding nothing.
Basically I need help composing a script that will allow my player to move by following the direction the mouse is pointing on the screen. I am trying to keep my view to be perfectly looking straight down.
Please note that I am new to Lua completely and am not looking to be spoon fed the script. But please be as detailed as possible so I can learn :D.
Thanks!
This script will just automatically move the character towards the mouse, if that’s what you are looking for.
local mouse = game.Players.LocalPlayer:GetMouse() mouse.Move:Connect(function() game.Players.LocalPlayer.Character.Humanoid:MoveTo(mouse.Hit.p) end)