Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How would one make a mobile shiftlock?

Asked by 2 months ago
Edited 2 months ago

Hello I attempted to mimic Roblox's shiftlock so I can apply it to mobile players and it works okay but when I equip a tool my character goes a little crazy, sometimes it feels like it's speeds up and slows down.

LocalScript:

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

while not player.Character do wait() end
local humanoidRootPart = player.Character.HumanoidRootPart

local camera = workspace.CurrentCamera

game:GetService("RunService").RenderStepped:Connect(function()
    local offset = (camera.CFrame.p - humanoidRootPart.Position).unit

    humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position) * CFrame.Angles(0, math.pi / 2 - math.atan2(offset.Z, offset.X), 0)
end)

Second thoughts I think it is due to me changing the HumanoidRootPart's CFrame in a LocalScript. The normal way out would be to use RemoteEvents, correct?? But there would be a slight delay and Roblox's shiftlock does not have a delay so neither do I want it.

Thanks for any help!!

0
I recently made a tool that was a bit too big for the character to hold, and that sped up the walkspeed in a way, are you sure it isn't because of the design of the tool? SteamG0D 560 — 2mo
0
Well I tested it with a normal part as the handle. I would like to know how to prevent it. GoldAngelInDisguise 238 — 2mo
0
So what the problem for me was that the handle's cancollide was set to true, and it was slightly inside the player's arm. So what you could try is set the tool's parts to cancollide=false and see if that fixes it. SteamG0D 560 — 2mo
0
did not work sorry GoldAngelInDisguise 238 — 2mo

Answer this question