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

Can you make the player's camera look like its in Shift Lock mode when a tool is equipped?

Asked by 5 years ago

Hello,

So I am making a game, which has guns. The way I want my game to work is by always being in a thrid person mode. For example, I think it was Polyguns, in which if you zoomed out of first person you were in a shift lock state, in which the mouse is at the centre of the screen, and the player is to the left.

What I want to do is, I want this to occur when a tool is equipped. How would i got about doing this?

So I know that in game.Players.LocalPlayer.PlayerScripts.CameraScript there is a script called RootCamera . In the script, I change this.Shiftlock = false to true and i also change

function this:GetShiftLock ()
       return ShiftLockController:IsShiftLocked()
end  

I changed it to the code block below. This would let the camera be in the shiftlock mode.

-- to this
function this:GetShiftLock ()
       return true
end  

This makes it permanent, from when join the game. (This is when camera script os placed StarterPlayerScripts

Can someone help me on how I would get around to only making this change of camera to shiftlock only when the tool is equipped.

So I would guess tool.OnEquipped() and UnEquipped() will be a massive part but I cant figure out how I would make the player get put into shiftlock when they equip the tool.

Can someone help or point me in the right direction?

Thanks,

Tony V

Answer this question