#Crawling Script
19 messages · Page 1 of 1 (latest)
** You are now Level 1! **
You didn
you didnt just copy and paste it did you
lua
local UIS = game:GetService("UserInputService")
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:WaitForChild("Animation"))
local isCrawling = false
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
if not isCrawling then
hum.WalkSpeed = 4
isCrawling = true
anim:Play()
else
hum.WalkSpeed = 12
anim:Stop()
isCrawling = false
--Put it here!!!
end
end
end)
** You are now Level 3! **
tell me if it works
Not to "Google it" you, but there's almost certainly a tutorial on how to use UIS to make a press and hold action
ah
here
UserInputService:IsKeyDown()
That should work
@silk garnet
For you it would be UIS:IsKeyDown()
** You are now Level 2! **
Here's a whole devforum post on the thing:
https://devforum.roblox.com/t/is-their-a-way-to-check-if-a-player-holds-down-a-key-with-userinputservice/1400161/6
What you could do is run an if statement for the key and check if its down using :IsKeyDown(), like such: (UserInputService:IsKeyDown) local UIS = game:GetService("UserInputService") local MyKey = Enum.KeyCode.[Insert your key] UIS.InputBegan:Connect(function(input,gameProcessed) if gameProcessed then return end if input.KeyCode == MyKey t...
You can try doing:
while UIS:IsKeyDown() do
end
Make sure to check for the key though