Hello, So I need help with a script.
What I need is that when a player holds down the key “C” It changes there walk animation and there standing animation and when they let go on the key “C” it changes back to the normal walk and standing animation.
I have look on devforum and other places and I cant find the solution I need.
Read the first link, that’s an introduction to animations. Then read the third link, that’s an introduction to UserInputService (that’s how you detect when they hold the C key), and then read the second, that’s how you play animations. Everything you need is there
And then you just have to combine the UserInputService with the animation play, and it will work
Hey, there’s a few ways to do this. Recently I made a sprinting system for a Horror game I’m working on, I used something like this to check when the player is holding down a key.
Local Script:
local Player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("RemoteEvent")
local UIS = game:GetService("UserInputService")
local key = Enum.KeyCode.C
local function IsKeyDown()
return UIS:IsKeyDown(key)
end
UIS.InputBegan:Connect(function(input)
if not IsKeyDown() then
--whatever you want to happen when the key isnt being held
print("key isnt being held")
else
--whatever you want to happen when the key is being held
print("key is being held")
end
end)