I want to make an animation play when i press 1 and when i press 1 again it stops, why doesnt this work?
local pl = game.Players.LocalPlayer
repeat
wait()
until pl.Character
local char = pl.Character
local hum = char:WaitForChild("Humanoid")
local hold = false
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.One then
print("one")
local sit = workspace.sit
local track = hum:LoadAnimation(sit)
track:Play()
end
end)
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.One then
print("one")
local sit = workspace.sit
local track = hum:LoadAnimation(sit)
track:Stop()
end
end)
local script in starter player
