#Shiftlock on console
91 messages · Page 1 of 1 (latest)
local UserInputService = game:GetService("UserInputService");
local SelectedShiftLock = Enum.KeyCode.ButtonL2; -- here
local players = game:GetService("Players");
local player = players.LocalPlayer;
local enabled = false;
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
local code = input.KeyCode;
if(code == SelectedShiftLock)then
if(enabled)then
player:SetAttribute("MouseLockEnabled", true)
else
player:SetAttribute("MouseLockEnabled", false)
end
enabled = not enabled;
end
end)```
This is my script + I have a module script for it
Send the module script too if you can
but like, it's a module script with alot of module scripts in it
Were there that many?
Yeah but i mean, inside of it should only be 2 more scripts if i dont bad remember
umm..
ok i saw them lol
the problem is probably that the module script is overwritting the inner workings of Shiftlock
local UserInputService = game:GetService("UserInputService");
local SelectedShiftLock = Enum.KeyCode.ButtonY; -- here
local players = game:GetService("Players");
local player = players.LocalPlayer;
--Local script in StarterPlayerCharacter
--Services:
local RunService = game:GetService("RunService")
--Variables:
local char = player.CharacterAdded:Wait();
local hum = char:WaitForChild("Humanoid")
local root = hum.RootPart -- The HumanoidRootPart
--Toggle Function:
function shiftLock(active) --Toggle shift.lock function
if active then
hum.CameraOffset = Vector3.new(1.75,0,0) -- I assume this is about the right camera offset.
hum.AutoRotate = false --Disable the automatic rotation since we are the ones setting it.
RunService:BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter --Set the mouse to center every frame.
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ() --Get the angles of the camera
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0) --Set the root part to the camera's rotation
end)
else
hum.AutoRotate = true --Let the humanoid handle the camera rotations again.
hum.CameraOffset = Vector3.new(0,0,0) --Move the camera back to normal.
RunService:UnbindFromRenderStep("ShiftLock") -- Allow mouse to move freely.
UserInputService.MouseBehavior = Enum.MouseBehavior.Default -- Let the mouse move freely
end
end
local enabled = false;
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
local code = input.KeyCode;
if(code == SelectedShiftLock)then
if(enabled)then
shiftLock(true)
else
shiftLock(false)
end
enabled = not enabled;
end
end)
@brazen hill try this, is a different way of making it, you can delete the module script
Okay so i deleted the old script and shift lock for console isn't here, do i take back the old console script too?
Okay so for console it isn't working but for pc it works like before
you sure it isnt working for console?
I replaced it by ButtonL2
K
Nope, still doesnt work
It is working for me in my xbox controller
try pressing 2 times
is it a local script?
Yep
send me your code here
no like the actual code
local UserInputService = game:GetService("UserInputService");
local SelectedShiftLock = Enum.KeyCode.ButtonY; -- here
local players = game:GetService("Players");
local player = players.LocalPlayer;
--Local script in StarterPlayerCharacter
--Services:
local RunService = game:GetService("RunService")
--Variables:
local char = player.CharacterAdded:Wait();
local hum = char:WaitForChild("Humanoid")
local root = hum.RootPart -- The HumanoidRootPart
--Toggle Function:
function shiftLock(active) --Toggle shift.lock function
if active then
hum.CameraOffset = Vector3.new(1.75,0,0) -- I assume this is about the right camera offset.
hum.AutoRotate = false --Disable the automatic rotation since we are the ones setting it.
RunService:BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter --Set the mouse to center every frame.
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ() --Get the angles of the camera
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0) --Set the root part to the camera's rotation
end)
else
hum.AutoRotate = true --Let the humanoid handle the camera rotations again.
hum.CameraOffset = Vector3.new(0,0,0) --Move the camera back to normal.
RunService:UnbindFromRenderStep("ShiftLock") -- Allow mouse to move freely.
UserInputService.MouseBehavior = Enum.MouseBehavior.Default -- Let the mouse move freely
end
end
local enabled = false;
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
local code = input.KeyCode;
if(code == SelectedShiftLock)then
if(enabled)then
shiftLock(true)
else
shiftLock(false)
end
enabled = not enabled;
end
end)```
I was uploading the pic before you ask me the question
im trying that exact same code and it is working for me
strange duh
mmmh
you were using ps controller?
ye
that shouldnt be the reason but maybe
local UserInputService = game:GetService("UserInputService");
local SelectedShiftLock = Enum.KeyCode.ButtonY; -- here
local players = game:GetService("Players");
local player = players.LocalPlayer;
--Local script in StarterPlayerCharacter
--Services:
local RunService = game:GetService("RunService")
--Variables:
local char = player.CharacterAdded:Wait();
local hum = char:WaitForChild("Humanoid")
local root = hum.RootPart -- The HumanoidRootPart
--Toggle Function:
function shiftLock(active) --Toggle shift.lock function
if active then
hum.CameraOffset = Vector3.new(1.75,0,0) -- I assume this is about the right camera offset.
hum.AutoRotate = false --Disable the automatic rotation since we are the ones setting it.
RunService:BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter --Set the mouse to center every frame.
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ() --Get the angles of the camera
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0) --Set the root part to the camera's rotation
end)
else
hum.AutoRotate = true --Let the humanoid handle the camera rotations again.
hum.CameraOffset = Vector3.new(0,0,0) --Move the camera back to normal.
RunService:UnbindFromRenderStep("ShiftLock") -- Allow mouse to move freely.
UserInputService.MouseBehavior = Enum.MouseBehavior.Default -- Let the mouse move freely
end
end
local enabled = false;
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
local code = input.KeyCode;
if(code == SelectedShiftLock)then
print(code)
if(enabled)then
shiftLock(false)
else
shiftLock(true)
end
enabled = not enabled;
end
end)
try this code and tell me what you get from the output
maybe what i should do is make some print
yeah i made a print
place a print inside here
RunService:BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter --Set the mouse to center every frame.
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ() --Get the angles of the camera
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0) --Set the root part to the camera's rotation
end) ```
(i know, not beautiful)
what line is it?
25
and where do i put the print?
under line 25
this is so weird, its getting there, but doesnt work
I only have 1 script and its the same you have it seems
Do you want me to add you to team create so you figure out?
ok
send it
Hello me back
Cause you need to disable normal shitflock
Custom shitflock x normal shitflock = 🙅♂️
83 msgs is crazy
wdym
I need to disable the shift lock, like players cant enable them in the settings tab?
Yep
Balls
** You are now Level 15! **
I'm not fully sure tho but I think it can solve most of your problem