Hey I wanted to make it so if you equip a tool you get forced into shiftlock and it doesnt work, the animation dosnt get played, I get no errors and it prints nothing maybe someone can help btw I got the system from a post: https://devforum.roblox.com/t/how-to-force-enable-shift-lock-without-changing-the-playermodule/1072967
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local tool = script.Parent
local Hanim = Humanoid.Animator:LoadAnimation(tool.HoldingAnim)
--force shiftlock:
local plr = game:GetService("Players").LocalPlayer
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local root = hum.RootPart
--Toggle Function:
function shiftLock(active)
if active then
hum.AutoRotate = false
hum.CameraOffset = Vector3.new(1.75,0,0)
game:GetService("RunService"):BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ()
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0)
end)
end
end
tool.Equipped:Connect(function()
Hanim:Play()
shiftLock(true)
print("equiped")
end)
tool.Unequipped:Connect(function()
Hanim:Stop()
shiftLock(false)
print("unequiped")
end)
Developer Forum | Roblox
Introduction Hello developers 🙂! I have seen many games accomplish some kind of “Force shift locking”, and most threads I’ve seen change the PlayerModule. This method accomplishes about the same result without changing the PlayerModule by CFraming. I believe this method is simpler, and if the PlayerModule changes again, this will still work. ...