How to Make a *POLISHED* Sprint and Stamina System in Roblox Studio (2023)

  Рет қаралды 16,323

Manly Creator

Manly Creator

Күн бұрын

In this video you'll learn how to create a sprint system with stamina and animations using character attributes!
-- BIG ANNOUNCEMENT --
My studio's game is nearing completion, but we need YOU to test the game and give feedback! By joining the Roblox group and Discord server, you'll gain access to unique rewards only given to testers!
Game Link: www.roblox.com/games/15143143...
Discord Server: / discord
Group Link: www.roblox.com/groups/3325056...
-- Timestamps --
Intro 0:00
Assigning Players Stats 0:06
Setting up Input 2:19
Setting up Stamina 4:15
Setting up Stamina Recharge 6:02
Creating the Stamina UI 9:05
Stamina UI Script 10:57
Adding Animations 12:49
Stopping Player Movement 14:04

Пікірлер: 110
@ManlyCreator
@ManlyCreator 6 ай бұрын
If if you enjoyed this video and want to support me then don't forget to try my game with the link in the description! I was trying a different style of video where I explain what I'm doing after doing it, so let me know in the replies what you thought of that and any questions you may have.
@tabimyers4257
@tabimyers4257 6 ай бұрын
This is great!
@StillCode
@StillCode 6 ай бұрын
On mobile the animation doesn’t work, also on pc whenever I use shift while standing the animation plays when I’m not moving. Other than that great video!
@misteryious
@misteryious 6 ай бұрын
Great video, though when I implement the animation feature it doesn't work. And it doesn't show any red errors in the output about it..
@StillCode
@StillCode 6 ай бұрын
@@misteryious his doesn’t work, so I made my own, when making put it on a loop or you’ll have to keep copy and pasting the animations
@coreyy2360
@coreyy2360 5 ай бұрын
@@StillCodedownload RealismMod plugin, it has a ton of options including disable shiftlock
@theactualsplit
@theactualsplit 3 ай бұрын
For the ppl that say they hold shift when they stay still and the animation still plays just put this under the print(stamina) if humanoid.MoveDirection.Magnitude
@SVNNYYT
@SVNNYYT 3 ай бұрын
THANK YOU SO MUCH BRO YOU SAVED MY GAME
@ChiseledMango-rz8eb
@ChiseledMango-rz8eb 2 ай бұрын
Tysm
@elliotingberg3848
@elliotingberg3848 3 ай бұрын
You should definitely keep doing these kinds of tutorials. You explaining what everything is doing actually makes me learn something!
@AlexSuperTV
@AlexSuperTV 5 ай бұрын
Best tutorial ever! Thank you so much.
@MaterOfAmoebes
@MaterOfAmoebes 19 күн бұрын
bro you just gained another subscriber!. Keep the good work up!
@Techie_Tac0
@Techie_Tac0 2 ай бұрын
Bro this is an insane tutorial! Thank you so much for the help! You are a freaking legend! Definitely underated! I spent 2 hours tryna figure this out and i came across this vid! LIFESAVER!!
@Azderts
@Azderts Ай бұрын
I’ve been trying to find a video where they show how to add walking and running animations separately, this video helped me
@georgayt7176
@georgayt7176 9 күн бұрын
This man is the most underrated person in the whole world
@SuperGotgames
@SuperGotgames Ай бұрын
This is actually good replication techniques and a good tutorial compared to alot in the community nice work!
@EddieTheCreator
@EddieTheCreator 4 ай бұрын
Thanks this video is super underrated now i can finally make a horror game
@user-qw8sw3lq8v
@user-qw8sw3lq8v 2 ай бұрын
trying to learn lua, great video explains everything and i can just copy what i dont get totally subbing
@davidfreshh7160
@davidfreshh7160 27 күн бұрын
Don’t rush. Take your time and actually let people write the code, and try your best to explain it in a slow manner. No harm I just want to help you!
@elidbear6543
@elidbear6543 Ай бұрын
bro this helped me so much beascuase my code was right. but I didn't known you had to set the scale first.
@Johnink03
@Johnink03 6 ай бұрын
the legend is back
@ManlyCreator
@ManlyCreator 6 ай бұрын
Haha thanks man, I hope you enjoy!
@Granite224
@Granite224 5 ай бұрын
can you make the next vid about how to make a skill tree + skill points system (and levels if u want) (but only if u want to)
@DraconianSG
@DraconianSG 6 ай бұрын
10:29 you can fix that by changing the green bars anchor point, rotating ui in roblox causes issues sometimes and it’s unreliable
@VeryProPlayerYesSir1122
@VeryProPlayerYesSir1122 6 ай бұрын
18th like from me. Keep making good content sir.
@suttreedelorge4587
@suttreedelorge4587 28 күн бұрын
just fyi at 12:32 the 1 - (1 - Stamina/MaxStamina) is redundant, all you need is Stamina/MaxStamina (because we want the percentage out of 1, which that already is! :) thanks so much for the tutorial
@BreezyEz-
@BreezyEz- 5 ай бұрын
is there a way to when you sprint the FOV changes?
@zergiu3982
@zergiu3982 5 ай бұрын
when i freeze while i run the runninganim is still going, how do i fix that?
@Firestarbright
@Firestarbright Ай бұрын
When I press Shift it just makes me COMPLETLY stop and I cant walk anymore. I can only jump
@thatonechannel990
@thatonechannel990 6 ай бұрын
sup dude its zeke w vidoe
@thatonechannel990
@thatonechannel990 6 ай бұрын
should do a video doing a menu system like when a player presses M or a keybind a gui with like differant stuff it in
@ManlyCreator
@ManlyCreator 6 ай бұрын
Yooo, thanks dude. A menu system is a good idea, I'll add that to my to-do list.
@gammajuice_
@gammajuice_ 8 күн бұрын
So ive run into the problem that after the stamina id implemented the sprint speed is immediately cut, the stamina still works but sprint speed dies for spme reason
@foxl_fc
@foxl_fc 5 ай бұрын
i dont know why but when i press shift when i idle the animation play, how can i fix this?
@T0m4t050up
@T0m4t050up Ай бұрын
how do i make other actions take stamina as well? dashing or rolling for example
@BrainDeadOG
@BrainDeadOG Ай бұрын
how would i change the remaining size to go right to left instead of up to down?
@user-cy2yn5en2j
@user-cy2yn5en2j 3 ай бұрын
bro iu stoped after 4 mins where u said test when i pressed shift i couldnt move at all i checked and everything was exactly the same i tried with r6 and r 15 none worked
@LyleTrumble
@LyleTrumble Ай бұрын
hey your videos are really helpful. I have confronted a problem; when I run out of stamina completely it pauses for about 5 seconds before I start to regenerate stamina. Is there a solution for this problem?
@HorizonX-YT
@HorizonX-YT 4 ай бұрын
can you make the same thing but you also loose stamina when you jump?
@zquwuuu
@zquwuuu 5 ай бұрын
bro if i hold shift when i say animation is playing how fix it?
@ceilingfan9659
@ceilingfan9659 24 күн бұрын
When im sprinting with the animation when I jump the jump animation doesnt play
@cozm_lol
@cozm_lol 2 күн бұрын
this is kind of late but for some reason it doesn’t apply the attributes. i have everything copied word for word yet it still doesn’t let me sprint use stamina etc
@zsunya2
@zsunya2 4 ай бұрын
Can you add a dashing system with this aswell?
@gemnmn
@gemnmn 5 ай бұрын
How did you get animations of the marketplace? What?!
@toothinm9paste
@toothinm9paste 6 ай бұрын
for the character config, is it possible to add additional attributes for more options like, mana points, vitality points, for additional game mechanics?
@ManlyCreator
@ManlyCreator 6 ай бұрын
Absolutely! Attributes are a very flexible way of controlling any kind of system you want to make.
@ToxinAnimations
@ToxinAnimations Ай бұрын
I did everything exactly how it says, but im getting and error that says "Begin is not a valid member of Enum.UserInputType" at line 9
@boredom315
@boredom315 28 күн бұрын
oh its enum.userinputstate.begin not userinputtype
@thatonechannel990
@thatonechannel990 6 ай бұрын
could you do a video on working on stuff 2d related like a 2 camera that works smoothly
@ManlyCreator
@ManlyCreator 6 ай бұрын
That's a good idea. Just like a 2D platformer, right?
@thatonechannel990
@thatonechannel990 6 ай бұрын
@@ManlyCreator yea since thats the type of game im maing
@ManlyCreator
@ManlyCreator 6 ай бұрын
@@thatonechannel990 It might be a while before I make a video like that, but if you need it soon I'd recommend checking out my top-down camera video. All you need to do is change the camera angle and it would work the exact same 👍
@bad_code0191
@bad_code0191 Ай бұрын
what if I want stamina to decrease when I jump can anyone suggest me
@TheRealPaintist
@TheRealPaintist 4 ай бұрын
W
@UsernameaBad
@UsernameaBad Ай бұрын
How to make the stamina bar horizontal without it bugging out
@yoda7481
@yoda7481 6 ай бұрын
I was wondering if it was possible to add wait(5) somewhere before it actually starts to recharge. Or make it so that once stamina reaches 50 or halway on the bar, it allows you to run again.
@mqte6759
@mqte6759 5 ай бұрын
maybe u could add a timer before the stamina regen event starts
@MOLONTOP
@MOLONTOP 2 ай бұрын
yeah i did that for 2 seconds till recharge but i made it so you could still sprint even if 1 second had passed but it wouldn't regen ur stamina
@8bitblox2
@8bitblox2 6 ай бұрын
I cant move at all i can jump but thats it
@xyizsilver
@xyizsilver 18 күн бұрын
if the player resets/dies the gui stops working
@neroisntdead3681
@neroisntdead3681 4 ай бұрын
Hey, im new to roblox studio, and this video is teaching me a lot, but for some reason, the game isnt applying the attributes to my character when I try testing it? I copied what you write letter for letter, but still nothing. Either way, again, thanks for the video!
@neroisntdead3681
@neroisntdead3681 4 ай бұрын
Nevermind, I was checking the wrong file, it works for now!
@toxomin9042
@toxomin9042 6 ай бұрын
what happens to the stamina draining when you have different fps? do you drain more or less stamina depending on your fps
@ManlyCreator
@ManlyCreator 6 ай бұрын
That's a really good question and I'm glad you brought that up. Players with a lower framerate would have a higher advantage since they would have less stamina subtracted each second. To fix this, use the equation (staminaUsage * 60 * delta) in place of just subtracting or adding staminaUsage. 60 assumes a base rate of 60 fps and delta is the time between each frame. Let's say a player's fps is 30, then the delta is going to be 0.03 (twice the delta of someone with 60 fps), therefore doubling the stamina used to balance out their usage with other players. Hope that makes sense.
@mrhekko9842
@mrhekko9842 6 ай бұрын
That really feels like an ai generated response lol@@ManlyCreator
@ziggykidder8861
@ziggykidder8861 5 ай бұрын
He did not show how to not make it so you dont play the anim while not moving so just add this in the SprintClient right before "Print(Stamina)" if humanoid.MoveDirection.Magnitude
@naistack
@naistack 4 ай бұрын
goodlooks wouldn't have figured it out
@isaiassampaio2319
@isaiassampaio2319 4 ай бұрын
Thank you so much, but now if I hold shift before moving the animation doesn't plays at all, It only plays if i'm already moving and then hold shift, any clues on fixing that?
@Slowezt
@Slowezt 5 ай бұрын
why is my map uncolided i was falling forever
@ichirouyoosh2008
@ichirouyoosh2008 2 ай бұрын
no model?
@TTTCozyy
@TTTCozyy 5 ай бұрын
The player still sprints even when the leftShift button is released. It only stops when the stamina runs out. Same for the animation. Is there a way to fix this? The player won't play the animation too. Please help. Thank you.
@MOLONTOP
@MOLONTOP Ай бұрын
you need input ended function, try this: UserInputService.InputEnded:connect(function(input) if input.keycode == enum.keycode.(your key) then character.Humanoid.WalkSpeed = "your base walkspeed" sprintanim(youranimation):stop()
@AllSeeingDuo666
@AllSeeingDuo666 5 ай бұрын
Can you make a version where the stamina bar only appears when your sprinting?
@HorizonX-YT
@HorizonX-YT 4 ай бұрын
I'm not sure, but I think you can change the visibility or transparency of the gui or frames when the player is sprinting. I haven't tested this out, but you can try!
@1245EK
@1245EK 5 ай бұрын
For some reason the attributes wont add to the humanoid :/
@singusaustinite
@singusaustinite 2 ай бұрын
same problem
@GalaxyNinjaX
@GalaxyNinjaX 5 ай бұрын
I've copied everything exactly, but it won't work. why?
@AnAvrageRobloxDev
@AnAvrageRobloxDev 5 ай бұрын
Any errors?
@Lavonplayzku311
@Lavonplayzku311 6 ай бұрын
Help when I was testing when I pressed shift my player stoped all I could do is jump and when I released shift it still wouldn’t move
@ManlyCreator
@ManlyCreator 6 ай бұрын
Would you mind showing me your script?
@harikrishnatankala6141
@harikrishnatankala6141 6 ай бұрын
problem started at 4:05 i am having the same problem and this is my script : character config: local module = { BaseWalkSpeed = 16, SprintSpeed = 32, Stamina = 100, MaxStamina = 100 } return module player data: --Services-- local RS = game.GetService("ReplicatedStorage") -- Settings-- local characterConfig = require(RS.Configuration.CharacterConfig) --Script-- game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) for stat, value in characterConfig do character.Humanoid:SetAttribute(stat, value) end end) end) SprintClient: --Services -- local CAS = game:GetService("ContextActionService") --script-- local character = script.Parent local humanoid = character:WaitForChild("Humanoid") local function sprint(actionName, inputState, inputType) if inputState == Enum.UserInputState.Begin then humanoid.WalkSpeed = humanoid:GetAttribute("SprintSpeed") elseif inputState == Enum.UserInputState.End then humanoid.WalkSpeed = humanoid:GetAttribute("BaseWalkSpeed") end end CAS:BindAction("Sprint", sprint, true, Enum.KeyCode.LeftShift )
@ziggykidder8861
@ziggykidder8861 5 ай бұрын
if humanoid.MoveDirection.Magnitude
@mrhekko9842
@mrhekko9842 6 ай бұрын
How do I make the make the user stop sprinting when he has stopped moving but still holding shift?
@ManlyCreator
@ManlyCreator 6 ай бұрын
For this you would have to do constant checks with the RunService. If you join my Discord and contact me I can give you better assistance.
@ziggykidder8861
@ziggykidder8861 5 ай бұрын
if humanoid.MoveDirection.Magnitude
@akeinSleeperbuild1278
@akeinSleeperbuild1278 2 ай бұрын
​@@ziggykidder8861 Thank god ur a life saver
@Okimiiii
@Okimiiii 6 ай бұрын
for some reason it wont work for me when i test at 4:13
@FrostyG15
@FrostyG15 5 ай бұрын
Same
@jiggity2538
@jiggity2538 3 ай бұрын
You must type humanoid.WalkSpeed with a uppercase S local function sprint(actionName, inputState, inputType) if inputState == Enum.UserInputState.Begin then humanoid.WalkSpeed = humanoid:GetAttribute("SprintSpeed") elseif inputState == Enum.UserInputState.End then humanoid.WalkSpeed = humanoid:GetAttribute("BaseWalkSpeed") end end This was my problem, idk about yours.
@secretwolfninja
@secretwolfninja 3 ай бұрын
why does it say walkspeed is not a valid member of humanoid? please help
@MOLONTOP
@MOLONTOP Ай бұрын
it may be because u typed it wrong, in script its not walkspeed its WalkSpeed(with capitals) and its not humanoid its Humanoid
@AppleCyder22
@AppleCyder22 2 ай бұрын
i cant see it ( am i blind??)
@thecheeseclanwastaken
@thecheeseclanwastaken 6 ай бұрын
How would i code the ui if I made it horizintal
@testdoang6161
@testdoang6161 5 ай бұрын
humanoid:GetAttributeChangedSignal("stamina"):Connect(function() local stamina = humanoid:GetAttribute("stamina") remaining.Size = UDim2.new( (stamina / maxStamina), 0, 1, 0 ) end)
@thecheeseclanwastaken
@thecheeseclanwastaken 5 ай бұрын
thanks!@@testdoang6161
@theactualsplit
@theactualsplit 4 ай бұрын
thx dawg ❤ @@testdoang6161
@Louisch1234
@Louisch1234 3 ай бұрын
@@testdoang6161 Thx so much
@littlesonic5451
@littlesonic5451 4 ай бұрын
why didnt it add the attributes? (i checked and everything was the same)
@SVNNYYT
@SVNNYYT 3 ай бұрын
did you add the comas after the numbers in the module script?
@SVNNYYT
@SVNNYYT 3 ай бұрын
1:57
@singusaustinite
@singusaustinite 2 ай бұрын
@@SVNNYYT i did but it still wouldnt work, any other solution?
@RushingAlt
@RushingAlt 6 ай бұрын
YOUR studio 🤔🤔🤔
@oBLXSSXDf
@oBLXSSXDf 2 ай бұрын
my stamina isnt draining
@oBLXSSXDf
@oBLXSSXDf 2 ай бұрын
nvm, I put :GetAttribute not :SetAttribute
@nexus1698
@nexus1698 4 ай бұрын
how would i get the ui to fade off screen if im not sprinting
@MOLONTOP
@MOLONTOP 2 ай бұрын
i was trying to do that but i couldn't come up with a way to
@ballsquare5
@ballsquare5 2 ай бұрын
whenever i set the rechargeTime below 0.5 the stamina does not regen anymore, and i want to make the stamina regen slower, any help?
Why Most Roblox Devs Quit (The Sad Truth...)
6:17
SmartyRBX
Рет қаралды 615 М.
Exploits Are EASY to Fix, People Are Just Lazy
11:42
ByteBlox
Рет қаралды 260 М.
Вечный ДВИГАТЕЛЬ!⚙️ #shorts
00:27
Гараж 54
Рет қаралды 14 МЛН
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 80 МЛН
10 Minutes vs. 10 Years of Animation
19:29
Isto Inc.
Рет қаралды 491 М.
3DTubers are Cool, Here's How I Became One
13:42
JayTheDevGuy
Рет қаралды 59 М.
I Spent 2,000 Hours Using Scratch
13:59
ggenije
Рет қаралды 511 М.
Simplest Way to Make a Ragdoll System - Roblox Studio 2023
9:49
Manly Creator
Рет қаралды 7 М.
AI Learns to steal
17:23
Dingus Labs
Рет қаралды 334 М.
How to make a Health Bar in Roblox
8:46
LuckyEcho
Рет қаралды 8 М.
How To HITBOX Like A PRO | Roblox Studio
6:23
Ludius
Рет қаралды 13 М.
Не обгоняйте Фуру в Австралии 😬
0:36
Авто.Бот
Рет қаралды 717 М.
You Can CHANGE Your Tesla Car’s Color?! #asher #shorts
0:36
Asher Lara
Рет қаралды 19 МЛН
When everyone is eyeing your car, let HornGun handle it! 🚗📸 #girl  #horngun #car
0:35
BossHorn - Train Horns with Remote Control
Рет қаралды 150 МЛН