#Is here anyone that coould help me?

1 messages · Page 1 of 1 (latest)

round sedge
#

Can someone Help me with it ?

local UserInputService = game.GetService("UserInputService")

local Plr = game.Players.LocalPlayer
local Char = Plr.Character
local Hum = Char.WaitForChild("Humaniod")
local SprintAnim= Hum.Animator:LoadAnimation(script.Run)

local Keybind = Enum.KeyCode.LeftShift
local SprintSpeed = 15

local Sprinting = false

local function StopSprint()
if Sprinting then
Sprinting = true
Hum.WalkSpeed -= SprintSpeed
SprintAnim:Stop(0.25)

end

end

local function StartSprint()
if not StartSprint then
Sprinting = true
Hum.WalkSpeed += SprintSpeed
SprintAnim:Play(0.25)
end
end

UserInputService.InputBegan:Connect(function(Input,IsTyping)
if IsTyping then return end
if Input.KeyCode == Keybind then
if not Sprinting then
StartSprint()

    end
end

end)

UserInputService.InputEnded:Connect(function(Input,IsTyping)
if Input.KeyCode == Keybind then
if Sprinting then
StopSprint()

    end
end

end)

nimble badgeBOT
#

studio** You are now Level 2! **studio

pallid bay
#

help with what specifically

valid notch
#

First issue is Hum = Char.WaitForChild

#

U need to use colon

#

I’m on phone, but I see alot of problems

#

Stopsprint function dosent stop sprint

#

It still sets sprintong to true

#

I would set the walkspeed to a fixed value instead of changing it as it might bug out if spammed

#

Also no reason to check if sprinting that many times

round sedge
#

The Sprinting does work

#

but the animation dosent work

round sedge
calm warren
round sedge
#

Yes

round sedge
calm warren
#

Could you show?

calm warren
#

Is what i meant

round sedge
#

wait ill send a video

round sedge
# calm warren Errors in console

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local Plr = Players.LocalPlayer
local Hum
local SprintAnim

local Keybind = Enum.KeyCode.E
local SprintSpeed = 15
local Sprinting = false
local DefaultWalkSpeed = 16 -- fallback if Humanoid.WalkSpeed isn't loaded yet

local function LoadSprintAnimation()
if not Hum then return end
local animator = Hum:FindFirstChildOfClass("Animator") or Hum:WaitForChild("Animator")
if animator then
local anim = Instance.new("Animation")
anim.Name = "Sprinting"
anim.AnimationId = "rbxassetid://108373350472949"
SprintAnim = animator:LoadAnimation(anim)
else
SprintAnim = nil
warn("Animator not found!")
end
end

local function StartSprint()
if not Sprinting and Hum then
Sprinting = true
DefaultWalkSpeed = Hum.WalkSpeed
Hum.WalkSpeed = DefaultWalkSpeed + SprintSpeed
if SprintAnim then
SprintAnim:Play(0.25)
end
end
end

local function StopSprint()
if Sprinting and Hum then
Sprinting = false
Hum.WalkSpeed = DefaultWalkSpeed
if SprintAnim then
SprintAnim:Stop(0.25)
end
end
end

UserInputService.InputBegan:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Keybind then
StartSprint()
end
end)

UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Keybind then
StopSprint()
end
end)

local function OnCharacterAdded(character)
Hum = character:WaitForChild("Humanoid")
Sprinting = false
LoadSprintAnimation()
Hum.Died:Connect(StopSprint)
end

-- Initial setup
if Plr.Character then
OnCharacterAdded(Plr.Character)
end
Plr.CharacterAdded:Connect(OnCharacterAdded)

#

I also changed but it dont work

calm warren
#

Can you show your output console?