I want it to be that when I slide I go faster the longer I slide, but when I stop sliding my speed will return to normal
here is my script:
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char.Humanoid
UIS.InputBegan:Connect(function(input,GPE)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.LeftControl then
while true do
hum.WalkSpeed = hum.WalkSpeed + 5
print(hum.WalkSpeed)
wait(1)
UIS.InputEnded:Connect(function(hit)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.LeftControl then
hum.WalkSpeed = 16
print("Break?")
return
end
end
end)
end
end
end
end)```
what I am not doing is: I’m sliding, but the longer I slide the faster I go. this is what I need your help with
it is not working, I want to go faster the longer I slide, but when I stop sliding, my WalkSpeed goes back to 16.
when you start sliding, you do go faster, but you don’t slow down
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.LeftControl then
hum.WalkSpeed = 16
print("Break?")
return
end
end
end)```
I believe that the problem is in that code block
sorry about the communication errors
UIS.InputEnded:Connect(function(hit)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.LeftControl then
hum.WalkSpeed = 16
print("Break?")
return
end
end
end)
To
UIS.InputEnded:Connect(function(input2)
if input2.UserInputType == Enum.UserInputType.Keyboard then
if input2.KeyCode == Enum.KeyCode.LeftControl then
hum.WalkSpeed = 16
print("Break?")
return
end
end
end)
Change the speed, i just edited the code so it prints “break?”
that almost worked, but if I press control, then the speed will go up, and when I let go of control, then the speed keeps going up, and when I hit control again, it just resets the speed and then goes up.
here is a simple script, you can change it (or ask me to change it) if you want something that i didn’t do
local players = game:GetService("Players")
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() --making sure the character loads
local humanoid = character:WaitForChild("Humanoid")
local isSliding = false
local slideSpeed = 20 --change
local slideKeycode = Enum.KeyCode.LeftControl
userInputService.InputBegan:Connect(function()
if userInputService:IsKeyDown(slideKeycode) then
isSliding = true
end
end)
userInputService.InputEnded:Connect(function()
if not userInputService:IsKeyDown(slideKeycode) then
isSliding = false
end
end)
runService.RenderStepped:Connect(function()
if isSliding then
humanoid.WalkSpeed = slideSpeed
else
humanoid.WalkSpeed = 16
end
end)
it doesn’t add??? i just checked the script, it works perfectly fine??? adds and removes? its supposed to be 20 (which is barely any change) you might want to check properties of humanoid or increase…