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

When Q and E are pressed; Its supposed to change the camera position but it doesnt. No error either?

Asked by 6 years ago

I have been modifying ROBLOX default camera script and at the moment I am trying to make it so when you press Q or E it will move your camera to your left or right shoulder.

If youve ever worked with ROBLOX's "Root Camera" module script youll see it have an Head offset and an R15 Head offset.

I am changing those numbers according to the key that is pressed but so far nothing happens nor does it error.

Any ideas?

Heres the code, its just a small portion of the root camera script.

local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0, 4, 0)
local HEAD_OFFSET = Vector3.new(1, 1.5, 0)
local R15_HEAD_OFFSET = Vector3.new(1.25, 2.0, 0)

-- Testing shoulder switching... Its broken at the moment
local function onQPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Q then
        R15_HEAD_OFFSET = Vector3.new(-4, 2, 0)
    end
end

local function onEPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then
        R15_HEAD_OFFSET = Vector3.new(1.25, 2, 0)
    end
end

game:GetService("UserInputService").InputBegan:connect(onQPress)

game:GetService("UserInputService").InputBegan:connect(onEPress)

You can see ROBLOX has all there head offsets here, I am attempting to change them when a key is pressed. But again it doesnt error nor does it work.

Thank you for your time :) Hopefully we can figure this out!

0
print debug? abnotaddable 920 — 6y
0
I mean I could try that. GottaHaveAFunTime 218 — 6y

Answer this question