You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to stop sprinting as soon as the “Sprintable” boolvalue is false -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have gone through many posts on the developer hub.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
local sprintable = Character:WaitForChild('Sprintable')
local sprinting = Character.Sprinting
players = game:GetService('Players')
player = players.LocalPlayer
char = game.Workspace[player.Name]
frame = player.PlayerGui.Stamina.bar
UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and sprintable.Value == true then
if frame.Size.X.Offset >= 0 then
Character.Humanoid.WalkSpeed = 25
local Anim = Instance.new('Animation')
Anim.AnimationId = 'rbxassetid://8308902269'
Character.Humanoid.JumpPower = 0
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
sprinting.Value = true
PlayAnim:Play()
wait()
Character.Humanoid.WalkSpeed = 16
Character.Humanoid.JumpPower = 50
PlayAnim:Stop()
sprinting.Value = false
else
return
end
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and sprintable.Value == true then
Character.Humanoid.WalkSpeed = 16
Character.Humanoid.JumpPower = 50
PlayAnim:Stop()
sprinting.Value = false
end
end)
Im new to scripting so dont mind the bad script
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.