Basically, I want an animation to play when a player hits a keybind. However the animation keeps playing in a loop instead of playing once.
local rp = game:GetService("ReplicatedStorage")
local re = rp.Animation.Set
local player = game.Players.LocalPlayer
local char = player.Character
local humanoid = char:WaitForChild("Humanoid")
local connection
local function anim()
local Set = Instance.new('Animation')
Set.AnimationId = 'rbxassetid://8083568248'
local SetTrack = humanoid:LoadAnimation(Set)
SetTrack:Play()
SetTrack.Stopped:Wait()
connection:Disconnect()
end
connection = re.OnClientEvent:Connect(anim)