Hey scripters and builders! In this tutorial, I will show you how to make a SHIFT KEYDOWN SCRIPT
Step 1: Make a local script Step 2: Make sure it is in STARTER PACK or STARTER GUI Step 3: Copy the code below!
--Client
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local default_speed = 16 --Do not change
local speed = 42 --Change it (optional)
mouse.KeyDown:Connect(function(key) --\\Key is the key pressed on the keyboard down
if key == "0" then --Shift is 0 on the keyboard
char.Humanoid.WalkSpeed = speed
end
end)
mouse.KeyUp:Connect(function(key) --\\Key when released up
if key == "0" then --Again, shift is 0 on the keyboard
char.Humanoid.WalkSpeed = default_speed
end
end)
So thats it! If you want it for mobile add this on the same script:
local contextAction = game:GetService("ContextActionService")
local running = false
--\\Run Func
local function mobileShift()
if running = false then
wait()
char.Humanoid.WalkSpeed = speed
contextAction:SetTitle("ShiftKey", "Unrun")
running = true
else
wait()
char.Humanoid.WalkSpeed = default_speed
contextAction:SetTitle("ShiftKey", "Run")
running = false
end
end
local shiftButton = contextAction:BindAction("ShiftKey", mobileShift, true, "shift")
contextAction:SetTitle("ShiftKey", "Run")
Thank you! Bye! Enjoy the script!