I have a script that should be cycling through a table of strings, and playing an animation based on which string is in the value at the time. Upon closer inspection, I found that the second value (DodgeAsset) Was not being changed for some reason. Any help is appreciated!
local C = script.Parent.Humanoid
Left = ("http://www.roblox.com/Asset?ID=318876532")
Right = ("http://www.roblox.com/Asset?ID=318875300")
CenterOverhead = ("http://www.roblox.com/Asset?ID=326759151")
LeftDodge = ("rbxassetid://326770084")
RightDodge = ("rbxassetid://326769779")
function ChooseAttack()
local AttackList = {"Left","Right","CenterOverhead"}
local A = script.Parent.DummyBrains.CombatValues.Asset
while wait() do
A.Value = AttackList[math.random(1, #AttackList)]
end
end
function ReactAndDodge()
local DodgeList = {"LeftDodge","RightDodge"}
local A = script.Parent.DummyBrains.CombatValues.DodgeAsset
while wait() do
A.Value = DodgeList[math.random(1, #DodgeList)]
end
end
function PlayAttack()
local A = Instance.new("Animation")
A.AnimationId = (script.Parent.DummyBrains.CombatValues.Asset.Value)
local animTrack = C:LoadAnimation(A)
animTrack:Play()
end
function PlayDodge()
local A = Instance.new("Animation")
A.AnimationId = (script.Parent.DummyBrains.CombatValues.DodgeAsset.Value)
local animTrack = C:LoadAnimation(A)
animTrack:Play()
end
while wait() do
ChooseAttack()
PlayAttack()
wait(0.5)
ReactAndDodge()
PlayDodge()
end

1 comment
Yeah it's because you a thousand infinite while loops.