How do I “Unloop” an animation?
alright this may sound weird, but I’m having trouble with my scripts, I want the animation
to stop playing after 0.4 seconds, however I have no clue how to do this, I’ve tried to set it’s value to false, but it doesn’t work. I searched it up, but didn’t find any helpful answer.
local remote = game.ReplicatedStorage.RemoteEvent
local tween = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local tweeninfo2 = TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
remote.OnServerEvent:Connect(function(player, Pos)
local Kunai = game.ReplicatedStorage.Kunai:Clone()
Kunai.Parent = game.Workspace
local char = game.Workspace:FindFirstChild(player.Name)
local leftarm = char["Left Arm"]
local beam = leftarm.Att01.Beam
local Att01 = leftarm.Att01
beam.Attachment0 = Att01
beam.Attachment1 = Kunai.Attachment
local hum = char:FindFirstChild("Humanoid", true)
local anim = hum:LoadAnimation(script.Animation)
anim:Play()
local number = 0
while number <= 0.15 do
Kunai.Position = Att01.WorldPosition
Kunai.Orientation = Att01.WorldOrientation
wait(.01)
number = number + 0.01
end
local goal = {Position = Pos}
local tweenp = tween:Create(Kunai, tweeninfo, goal)
tweenp:Play()
wait(0.1)
local hrp = char:FindFirstChild("HumanoidRootPart", true)
local animpl = hum:LoadAnimation(script.Animation2)
animpl:Play()
animpl.Looped = true
local tweenp2 = tween:Create(hrp, tweeninfo2, goal)
tweenp2:Play()
wait(0.4)
animpl.Looped = false
end)
Specifically this part
animpl.Looped = true
local tweenp2 = tween:Create(hrp, tweeninfo2, goal)
tweenp2:Play()
wait(0.4)
animpl.Looped = false
I’m stuck with the animation, if you could help me “Unloop” it, so stop playing the animation I’d be happy, thank you for reading.