Well, I have a problem with the animations of the character, specifically the running and walking. The player’s initial speed (walk) is 7, the maximum running speed is 22, and the animation is automatically changed depending on the speed (below ten, the animation is walking; above ten, the animation is running). My problem is that sometimes the animation crashes and it looks bad.
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SprintHunger = ReplicatedStorage:WaitForChild("SprintHunger")
local Player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait()
local Character = Player.Character or Player.CharacterAdded:wait(1)
local SystemMaterial = Character:WaitForChild("Sistemas")
local PlayerGui = Player:WaitForChild("PlayerGui")
local Crouch = script.Parent:WaitForChild("Crouch"):WaitForChild("CrouchVal")
local Sprint = Player:WaitForChild("SettingsData"):WaitForChild("Keys"):WaitForChild("Sprint")
local MenuDeMapa = PlayerGui:WaitForChild("MenuDeMapa")
local CharacterServices = MenuDeMapa:WaitForChild("CharacterServices")
local Running = false
UserInputService.InputBegan:Connect(function(inputObject, gameprocess)
if (inputObject.KeyCode == Enum.KeyCode.LeftShift) or (inputObject.KeyCode == Enum.KeyCode.RightShift) and (not gameprocess) then
if Sprint.Value == "Keep" then
if CharacterServices.Value == true then
if SystemMaterial:WaitForChild("Taken").Value == true then
if SystemMaterial:WaitForChild("TakenSelect").Value == "Lumber" then
Character.Humanoid.WalkSpeed = 15
end
else
Character.Humanoid.WalkSpeed = 22
end
SprintHunger:FireServer()
Running = true
end
end
end
end)
UserInputService.InputEnded:Connect(function(inputObject, gameprocess)
if (inputObject.KeyCode == Enum.KeyCode.LeftShift) or (inputObject.KeyCode == Enum.KeyCode.RightShift) and (not gameprocess) then
if Sprint.Value == "Keep" and CharacterServices.Value == true then
if SystemMaterial:WaitForChild("Taken").Value == true then
if SystemMaterial:WaitForChild("TakenSelect").Value == "Lumber" then
Character.Humanoid.WalkSpeed = 7
end
else
Character.Humanoid.WalkSpeed = 8.5
end
SprintHunger:FireServer()
Running = false
end
end
end)
robloxapp-20211022-1300420.wmv (3.0 MB)