normal script:
local forward = script.Forward
local left = script.Left
local right = script.Right
local run = script.Run
local back = script.Back
local forwardvel = script.Parent.Parent.Parent.Forward
local angler = script.Parent.Parent.Parent.Turn
while true do
wait()
if forward.Value == true then
run.Value = false
back.Value = false
--play an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Play()
-------------------------------------------------------------------
forwardvel.Velocity = script.Parent.Parent.Parent.CFrame.LookVector * 15
elseif forward.Value == false and back.Value == false then
--stop an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Stop()
-------------------------------------------------------------------
forwardvel.Velocity = Vector3.new(0,0,0)
end
if left.Value == true then
right.Value = false
--play an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Play()
-------------------------------------------------------------------
angler.AngularVelocity = Vector3.new(0,2,0)
elseif left.Value == false and right.Value == false then
--stop an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Stop()
-------------------------------------------------------------------
angler.AngularVelocity = Vector3.new(0,0,0)
end
if right.Value == true then
left.Value = false
--play an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Play()
-------------------------------------------------------------------
angler.AngularVelocity = Vector3.new(0,-2,0)
elseif right.Value == false and left.Value == false then
--stop an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Stop()
-------------------------------------------------------------------
angler.AngularVelocity = Vector3.new(0,0,0)
end
if run.Value == true then
forward.Value = false
--play an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim2 = script.Parent.Parent.Parent.Animations.Run
local loaded2 = controller:LoadAnimation(chosenanim2)
loaded2:Play()
-------------------------------------------------------------------
forwardvel.Velocity = script.Parent.Parent.Parent.CFrame.LookVector * 30
end
if back.Value == true then
forward.Value = false
run.Value = false
--play an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Play()
-------------------------------------------------------------------
forwardvel.Velocity = script.Parent.Parent.Parent.CFrame.LookVector * -5
elseif back.Value == false and forward.Value == false then
--stop an animation------------------------------------------------
local controller = script.Parent.Parent.Parent.Parent.AnimationController
local chosenanim = script.Parent.Parent.Parent.Animations.Walk
local loaded = controller:LoadAnimation(chosenanim)
loaded:Stop()
-------------------------------------------------------------------
forwardvel.Velocity = Vector3.new(0,0,0)
end
end
this script manages controls for an npc, if certain values are turned on or off this script performs actions. after adding animations for the npc to use I noticed an error:“AnimationTrack limit of 256 tracks for one animator exceeded. no new tracks will be played”. what is the cause and how can I fix it?