SmoothShiftLock [Module]

put the script in startercharacterscripts instead, it works for me there

game.Workspace.Camera.CameraSubject = script.Parent:WaitForChild("Head")

I don’t think you did read my post, right?

I did I just copied and pasted the script I’m using now, thats why I didnt correct the camera thing

I love the smoothness of the shift lock. Great job, definitely will be using for future projects.

1 Like

That code example doesn’t work for me

local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer 

local SmoothShiftLock = require(localPlayer.PlayerScripts:WaitForChild("CustomShiftLock"):WaitForChild("SmoothShiftLock"))
local ToggleEvent = SmoothShiftLock.ToggleShiftLock;

local button = script.Parent

button.Activated:Connect(function()
	ToggleEvent:Fire(not SmoothShiftLock:IsEnabled());
end);
  22:26:22.234  Players.Im_Andr3i.PlayerGui.MainScreenGui.ReferenceJumpFrame.ShiftButton.LocalScript:10: attempt to index function with 'Fire'  -  Client - LocalScript:10
  22:26:22.234  Stack Begin  -  Studio
  22:26:22.234  Script 'Players.Im_Andr3i.PlayerGui.MainScreenGui.ReferenceJumpFrame.ShiftButton.LocalScript', Line 10  -  Studio - LocalScript:10

getting rid of the Fire part also doesn’t work either.

local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer 

local SmoothShiftLock = require(localPlayer.PlayerScripts:WaitForChild("CustomShiftLock"):WaitForChild("SmoothShiftLock"))
local ToggleEvent = SmoothShiftLock.ToggleShiftLock;

local button = script.Parent

button.Activated:Connect(function()
	ToggleEvent:(not SmoothShiftLock:IsEnabled());
end);
Nothing?

Please fix this and please make sure that your code examples are actually working as usual, @Rixtys99.

Edit: You were trying to access the ToggleShiftLock function, not the bindable event.
Try this code:

local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer 

local SmoothShiftLockModule = localPlayer.PlayerScripts:WaitForChild("CustomShiftLock"):WaitForChild("SmoothShiftLock");
local SmoothShiftLock = require(SmoothShiftLockModule);

local ToggleEvent = SmoothShiftLockModule.ToggleShiftLock;

local button = script.Parent

button.Activated:Connect(function()
	ToggleEvent:Fire(not SmoothShiftLock:IsEnabled());
end);
1 Like

Thank you, is there an custom event (that my localscript can listen to) where when a player toggles the shift lock on or off? I need an event so that the shift lock button icon (that I made) would update if the player presses Shift.

1 Like

There wasn’t an event like that, but I updated the module and implemented it.
Update your module to the newest version to use it.

Module version 1.1.4

Changes:

  • Added a ShiftLockToggled event that fires every time shiftlock’s toggled.
    Example usage:
local SmoothShiftLock = require([SHIFT_LOCK_DIRECTORY].SmoothShiftLock);

SmoothShiftLock.ShiftLockToggled:Connect(function(Toggle: boolean)
	print(Toggle);
end);
1 Like

Its bugging on my side saying “self.camOffsetSpring” doesn’t exist.

Hey, I’m using this module and I really like it so far! I’m having issues with a ragdoll system I made, though.

I’m a beginner scripter, so pardon if this is a dumb question, but how would I go about toggling the shift lock on and off through a local script? I’m using a ragdoll system, and I’m trying to make it so that when the player is ragdolled, the character stops moving with the camera. Currently the ragdoll just twists around with the camera and it looks awful, so I’m trying to figure out how to fix it.

Any advice would be appreciated!

When does that happen? When the module is just running or when you’re trying to access the ToggleShiftLock method because doing it incorrectly may cause this error.

Hello, enabling Humanoid.Sit while the humanoid is ragdolled should fix this.

Like combat warriors, I’d like the shoulders to slump each time the screen rotates with Shift Lock on.

I get what you mean, I tried to do that the first time making this module but it didn’t work out as smoothly as it should. I believe Combat Warriors use BodyGyros for their ShiftLock which is deprecated and sometimes buggy (It’s the reason you can super jump in cw). And I’m unsure how to do it unless you experiment with it yourself.

When I use shiftlock, it turns my camera + character position while in my cutscenes, I tried setting shiftlock off and made it so that player cant turn it on during it. But self.camOffsetSpring becomes nil when I use SmoothShiftLock:ToggleShiftLock from anywhere else

If you want to toggle the ShiftLock from an external script you need to use the ToggleShiftLock bindable which is located inside the SmoothShiftLock module script.

Also mentioned in the module script at line 21:

@ Bindables = {
	module.ToggleShiftLock:Fire(boolean)
	Toggles ShiftLock. (Automatically bind to SHIFT_LOCK_KEYBINDS on initialization)
		
	module.EditConfig:Fire(configName, value)
	Edits the ShiftLock's config. (Line 51)
}

This does not work, It indexs nil with speed from camOffsetSpring , The spring.new() becomes nil for no reason at all

I’m not quite sure why that is occurring, could you send me the script that’s toggling the ShiftLock?
Also, there’s already a code example of what you’re trying to achieve here.

Genuine inquiry how would I go about toggling shiftlock for a mobile player with your version of smoothShiftlock integrated into the playerModule?

When i try to use module.EditConfig:Fire() with any config name and value, it always says
image
im using require() to address module script, also i dont have .EditConfig as proper action i can do with module