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:
01 | print ( "Intalized Camera Script" ) |
02 |
03 | local RunService = game:GetService( "RunService" ) |
04 | local Players = game:GetService( "Players" ) |
05 |
06 | local OFFSET = Vector 3. new( 0 , 400 , 0 ) |
07 | local FOV = 30 |
08 |
09 | local player = Players.LocalPlayer |
10 | local camera = game.Workspace.CurrentCamera |
11 |
12 | camera.FieldOfView = FOV |
13 |
14 | local function onRenderStep() |
15 | local character = player.Character |
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.
1 | local mouse = game.Players.LocalPlayer:GetMouse() |
2 | mouse.Move:Connect( function () |
3 | game.Players.LocalPlayer.Character.Humanoid:MoveTo(mouse.Hit.p) |
4 | end ) |