SmoothShiftLock [Module]

heyyy this is pretty cool!!
image

1 Like

Looks like Lerp glitches out if you set CHARACTER_ROTATION_SPEED too high.
Also, I noticed CHARACTER_SMOOTH_ROTATION works not how it’s supposed to, so I fixed that.

I changed the module a little so update it. Also, I would suggest you use lower values for CHARACTER_ROTATION_SPEED if you don’t want it glitching because it’s Lerp’s fault and I can’t really change the way Lerp behaves. And you can set CHARACTER_SMOOTH_ROTATION to false if you want to disable character Lerping (It wasn’t working before because I made a little mistake in the code).

1 Like

Same for me. Please fix this
image

2 Likes

It wasn’t working before because it didn’t detect when the character was being loaded/respawned, only when the character died. Anyways, now it’s fixed, thank you both for the bug report!

Updated the module to version 1.0.8

Changes:

  • Fully works with Player:LoadCharacter()
  • Very slight optimizations
3 Likes

this works! the shiftlock actually works!!! thank you!

2 Likes

i have a question, is it possible to make this into contextactionservice compatible ?
and good module btw its so good

3 Likes

Yes, you can do module.ToggleShiftLock:Fire(toggle) to toggle the shift lock. So if you wanted to add mobile support you can do something like:

local ContextActionService = game:GetService("ContextActionService");
local ToggleEvent = [SHIFT_LOCK_DIRECTORY].SmoothShiftLock.ToggleShiftLock;

local Active = false;

local function ToggleShiftLock(actionName, inputState, _inputObject)
	if actionName == "TOGGLE_SHIFT_LOCK" and inputState == Enum.UserInputState.Begin then
		Active = not Active;
		ToggleEvent:Fire(Active);
	end;
end;

ContextActionService:BindAction("TOGGLE_SHIFT_LOCK", ToggleShiftLock, true);

But, if you want to fully change it to ContextActionService you can unbind all the binds in the settings and make a script that binds the shift lock toggle with module.ToggleShiftLock:Fire(toggle).

2 Likes

can you please explain this cause I haven’t looked into PlayerModule that much

How can i do that with mousedown?
The contextactionservice button look bad.

Yooo ty for uploading will save loads of time this module is great…
Preview - YouTube

works good on a combat system I made

(don’t judge my bow its still in development XD for some reason I made it without a handle so I cant lerp the motor6d for up and down)

1 Like

Just like with ContextActionService, except now you’re checking for MouseButtonDown.

A few examples:
Making the ShiftLock toggle after clicking left mouse button

local UserInputService = game:GetService("UserInputService")
local SmoothShiftLock = require([SHIFT_LOCK_DIRECTORY].SmoothShiftLock);

local ToggleEvent = [SHIFT_LOCK_DIRECTORY].SmoothShiftLock.ToggleShiftLock;

local function ToggleShiftLock()
	ToggleEvent:Fire(not SmoothShiftLock:IsEnabled());
end;

UserInputService.InputBegan:Connect(function(Input, gpe)
	if not gpe and Input.UserInputType == Enum.UserInputType.MouseButton1 then
		ToggleShiftLock();
	end;
end);

Making the ShiftLock be locked whilst holding right mouse button

local UserInputService = game:GetService("UserInputService")

local ToggleEvent = [SHIFT_LOCK_DIRECTORY].SmoothShiftLock.ToggleShiftLock;

local function ToggleShiftLock(toogle: boolean)
	ToggleEvent:Fire(toogle);
end;

UserInputService.InputBegan:Connect(function(Input, gpe)
	if not gpe and Input.UserInputType == Enum.UserInputType.MouseButton2 then
		ToggleShiftLock(true);
	end;
end);

UserInputService.InputEnded:Connect(function(Input, gpe)
	if not gpe and Input.UserInputType == Enum.UserInputType.MouseButton2 then
		ToggleShiftLock(false);
	end;
end);

Also, don’t forget that you can customize the ContextActionService button. [See more]
I hope this helps!

What about activating the shiftlock using a GUI button lusing something like

Button.Mousebutton1Down:Connect(function()?

Also the same.

Example:

local SmoothShiftLock = require([SHIFT_LOCK_DIRECTORY].SmoothShiftLock);

local Button = script.Parent;
local ToggleEvent = [SHIFT_LOCK_DIRECTORY].SmoothShiftLock.ToggleShiftLock;

Button.Activated:Connect(function()
	ToggleEvent:Fire(not SmoothShiftLock:IsEnabled());
end);

Also, I fixed a small bug, SmoothShiftLock:IsEnabled() wasn’t working before, so I fixed it.

I put the script in the button, appearently it won’t locate [SHIFT_LOCK_DIRECTORY]
How can i locate that?

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local ToggleEvent = Player.PlayerScripts:WaitForChild("CustomShiftLock").SmoothShiftLock.ToggleShiftLock;

local function ToggleShiftLock(toogle: boolean)
	ToggleEvent:Fire(toogle)
end;

UserInputService.InputBegan:Connect(function(Input, gpe)
	if not gpe and Input.UserInputType == Enum.UserInputType.MouseButton2 then
		ToggleShiftLock(true)
	end
end)

UserInputService.InputEnded:Connect(function(Input, gpe)
	if not gpe and Input.UserInputType == Enum.UserInputType.MouseButton2 then
		ToggleShiftLock(false)
	end
end)

Line 4:
local ToggleEvent = Player.PlayerScripts:WaitForChild(“CustomShiftLock”)…

1 Like

Dumb little hack to make this work with the AutoRotate property:


(Lines 202-204 and 207 should be modified)

It disables the autorotate so your character wouldn’t glitch whilst you use the shift lock and walk, what you did is that you stopped the autorotate property from getting changed which means that the character would glitch now if you used the shift lock and walked at the same time.

I fixed this by using a custom attribute instead of autorotate.

The code will display the custom icon in studio and when using the Microsoft roblox app, but whenever I play from the roblox website it wont show the icon

That’s weird, if I remember right it uses Mouse.Icon to change the cursor’s icon, which should probably get changed to UserInputService.MouseIcon because I think Roblox updated it.
Also, check if there are any errors in the console, if not then you can either wait till I come back home and fix it or find that part of the code yourself and change it the way I mentioned.