#While and UIS:IsKeyDown [Not Solved]

12 messages · Page 1 of 1 (latest)

vital yacht
#

one piece reference

marble hazel
#

like what 💀

cunning gulch
#
local RS = game:GetService("ReplicatedStorage")

local Remotes = RS:WaitForChild("Remotes")
local Remote = Remotes:WaitForChild("FlashStep")

local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")

local MyKey = Enum.KeyCode.Q
local isKeyDown = false

UIS.InputBegan:Connect(function(key)
    if key.KeyCode == MyKey then
        isKeyDown = true
        Remote:FireServer()
    end
end)

UIS.InputEnded:Connect(function(key)
    if key.KeyCode == MyKey then
        isKeyDown = false
    end
end)

local function updateWalkSpeed()
    if isKeyDown then
        hum.WalkSpeed = 50
    else
        hum.WalkSpeed = 16
    end
end

game:GetService("RunService").Heartbeat:Connect(updateWalkSpeed)
#

try this

marble hazel
#

i wanted it to stop running after half a second then continue to run again

#

btw what is run service and .Heartbeat

cunning gulch
#

heartbeat is a event that fires every frame like it runs once per frame

marble hazel
#

sounds useful

marble hazel
#

While and UIS:IsKeyDown [Not Solved]

marble hazel
#

ye it would loop while having a wait in between

#

so it would start fast wait go slow restart