#Trying to make my walkspeed slower when a key is held

1 messages · Page 1 of 1 (latest)

torn oak
#

local UserInputService = game:GetService("UserInputService")
local ReplecatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local Events = ReplecatedStorage:WaitForChild("Events")

local Character = script.Parent.Parent

local IsBlocking = false

UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent then
return
end

if Input.UserInputType == Enum.UserInputType.MouseButton1 and not IsBlocking then
    Events.ClickAttack:FireServer()
end

if Input.KeyCode == Enum.KeyCode.F then
    IsBlocking = true
    Events.Block:FireServer(true)
    Character.Humanoid.WalkSpeed = 8
end

end)

UserInputService.InputEnded:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent then
    return
end

if Input.KeyCode == Enum.KeyCode.F then
    IsBlocking = false
    Events.Block:FireServer(false)
    Character.Humanoid.Walkspeed = 16
end

end)

#

When I use this, It slows my speed but it doesnt go back to the normal speed

restive basalt
#

WalkSpeed*

torn oak
#

Omg😭

restive basalt
torn oak
#

Yeah thank you