I want to make my script that a punch animation when I press a key button the animation will play every script will disable and can't move anything?
Sorry For My Grammar.
local player = game.Players.LocalPlayer
local db = true
local damage = false
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset?id=3641946843"
game.Players.LocalPlayer.Character:WaitForChild("RightHand").Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not db and not damage and hit.Parent.Humanoid ~= game.Players.LocalPlayer.Character.Humanoid then
if game.Players.LocalPlayer.Character.Humanoid.Health > 0 then
damage = true
game.ReplicatedStorage.Punch:FireServer(hit.Parent.Humanoid)
end
end
end)
game:GetService("UserInputService").InputBegan:Connect(function(input, event)
if input.KeyCode == Enum.KeyCode.E and db then
db = false
local playAnim = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):loadAnimation(anim)
playAnim:Play()
wait(0.8)
damage = false
db = true
end
end)

3 comments
all script disable cause if i use sprint script animation will cancle
make object boolValue called AnimIsplaying and make it true when anymation playes, make sprint script to check constantly if AnimIsPlaying is true, and if it si it should now make player sprint, in other words it should only make player run, if AnimIsPlaying is false
make object boolValue called AnimIsplaying and make it true when anymation playes, make sprint script to check constantly if AnimIsPlaying is true, and if it si it should now make player sprint, in other words it should only make player run, if AnimIsPlaying is false