Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Overhead camera disables character movement?

Asked by
Nikkulaos 229 Moderation Voter
6 years ago
Edited 6 years ago

I am working on making an overhead camera for my game.

I tried this a while ago and had no issues, but however just today i tried it and i cant seem to be able to "control" my player's character. Pressing "Arrow Keys" or "WASD" do nothing.

The script itself was pretty easy, but i am puzzled on this part. I tried zooming the camera in, and out, and it still wont let my character move. The only way to actually make it work is if i change the X and Z coordinates as well when editing the camera.

Script (you can see how i only edited the Y coordinates):

local runService = game:GetService('RunService')
local function onRenderStep()
end
local offset = Vector3.new(0,40,0)
local player = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
local runService = game:GetService('RunService')
local function onRenderStep()
    local playerPosition = player.Character.Head.Position
    local cameraPosition = playerPosition + offset
    camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end
runService:BindToRenderStep( 'Camera', Enum.RenderPriority.Camera.Value, onRenderStep)

If you know why this is then please help :P

Thanks!

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

I'm guessing you put this in StarterPlayerScripts, in which case I'm also guessing, did you you name the script "CameraScript" by any chance?

If you put a script called CameraScript in StarterPlayerScripts, ROBLOX will over-write the default camera/movement script with it. This can be super useful in some instances, as you don't have to manually disable ROBLOX's default scripts, but in your case it's problematic as it's disabled your movement when you didn't want it to. I'm honestly not sure why the Camera script and Movement script are linked, but they seem to be.

If I'm correct and it is titled CameraScript, simply rename the script to something else, and it should work. If not, get back to me and I'll take another crack at it. :)

1
Thanks for the reply, but the script is named "LocalScript". Hopefully its just a quick studio bug Lol Nikkulaos 229 — 6y
0
Strange, because it seems to work for me. Maxwell_Edison 105 — 6y
Ad

Answer this question