This script should be playing an animation based on whether Stance.Value = right or left. It plays the cooresponding animation for 'left' but not for right. It's strange. Any help is appreciated.
--Player Values
local move_left = false
local move_right = false
local already_ran = false
local grounded = false
local idleAnimation = Instance.new("Animation")
idleAnimation.AnimationId = "rbxassetid://317651678"
local runningAnimation = Instance.new("Animation")
runningAnimation.AnimationId = "rbxassetid://319211805"
local R2 = Instance.new("Animation")
R2.AnimationId = "rbxassetid://319228239"
--local I2 = Instance.new("Animation")
--I2.AnimationId = "rbxassetid://319228239"
function playAnimation(parent)
local AnimTrack = player.Character.Humanoid:LoadAnimation(parent)
AnimTrack:Stop()
wait(.1)
AnimTrack:Play()
end
function onGround(speed)
if grounded == false then
grounded = true
end
if speed > 1 and player.PlayerGui.SwordPlaySystem.Stance.Value == ("Left") then -- This one works
if already_ran == false then
already_ran = true
playAnimation(runningAnimation)
elseif speed > 1 and player.PlayerGui.SwordPlaySystem.Stance.Value == ("Right") -- this one doesn't
then
if already_ran == false then
already_ran = true
playAnimation(R2)
end
end
else
already_ran = false
playAnimation(idleAnimation)
end
end
end

1 comment
what type of scirpt is it in