Hi, I am making this game and I made this Animation/Sprint script but whenever I equip a tool/Sword and run my character gets bugged in a weird way, but when I run without holding any Weapons it plays the animation normally.
I want help fixing it maybe it has to do something with the script and not the Animation
if running then
local primary_weapon = replicatedstorage.Weapons:FindFirstChild(client_data.PrimaryWeapon.Value)
if primary_weapon then
local weapon_type = primary_weapon.Type.Value
if weapon_type == "Sword" and client_alive:FindFirstChild("Has Weapon") and not saber_sprint.IsPlaying then
stop_running()
saber_sprint:Play()
saber_sprint:AdjustSpeed(1.5)
elseif weapon_type == "Greatsword" and client_alive:FindFirstChild("Has Weapon") and not greatsword_sprint.IsPlaying then
stop_running()
greatsword_sprint:Play()
greatsword_sprint:AdjustSpeed(1.5)
elseif not normal_sprint.IsPlaying then
stop_running()
normal_sprint:Play()
normal_sprint:AdjustSpeed(1.5)
end
end
elseif saber_sprint.IsPlaying or normal_sprint.IsPlaying or greatsword_sprint.IsPlaying then
stop_running()
end
first off ur doing 2 loops at the same time, thats just breaking ur code and lagging a lot even if u use runservice, second why are u using a loop for a sprint script?
I Didn’t actually make the script I just modified it to work with Different types of weapons so instead of it just doing normal Sprint Anim if the player is holding a weapon and the client script sees that the weapons Type is “Sword” it plays Another Animation instead of the default sprint. and then I don’t understand why the default works while holding a tool doesn’t
Sorry for not saying that I just modified it and didn’t fully script it
It only plays the animation if the sprint event is fired the problem is somewhere here
if weapon_type == "Sword" and client_alive:FindFirstChild("Has Weapon") and not saber_sprint.IsPlaying then
stop_running()
saber_sprint:Play()
saber_sprint:AdjustSpeed(1.5)
elseif weapon_type == "Greatsword" and client_alive:FindFirstChild("Has Weapon") and not greatsword_sprint.IsPlaying then
stop_running()
greatsword_sprint:Play()
greatsword_sprint:AdjustSpeed(1.5)
elseif not normal_sprint.IsPlaying then
stop_running()
normal_sprint:Play()
normal_sprint:AdjustSpeed(1.5)
end
end
elseif saber_sprint.IsPlaying or normal_sprint.IsPlaying or greatsword_sprint.IsPlaying then
stop_running()
end