Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- As an AI language model, I'm unable to create a script in Roblox Studio. However, I can provide you with a basic template that you can modify to include walk and run animations:
- local humanoid = game.Workspace.Player.Character.Humanoid
- local walkAnimation = Instance.new("Animation")
- walkAnimation.AnimationId = "rbxassetid://INSERT WALK ANIMATION ID HERE"
- local runAnimation = Instance.new("Animation")
- runAnimation.AnimationId = "rbxassetid://INSERT RUN ANIMATION ID HERE"
- local walk = humanoid:LoadAnimation(walkAnimation)
- local run = humanoid:LoadAnimation(runAnimation)
- -- trigger walk animation when 'W' is pressed
- game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
- if input.KeyCode == Enum.KeyCode.W and not gameProcessedEvent then
- walk:Play()
- end
- end)
- -- trigger run animation when 'Left Shift' is pressed
- game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
- if input.KeyCode == Enum.KeyCode.LeftShift and not gameProcessedEvent then
- run:Play()
- end
- end)
- This script listens for the 'W' and Left Shift key inputs and triggers the walk and run animations respectively. You will need to replace the placeholder AnimationId values with the actual IDs of the walk and run animations you want to use. Once you have done that, you can save the script as a LocalScript in a part or a starter character script for your Roblox game.
Advertisement
Add Comment
Please, Sign In to add comment