-
What do you want to achieve? Keep it simple and clear!
for there to be a stop or break between punch, so when the player punches it takes a moment or 2 before they can punch again -
What is the issue? Include screenshots / videos if possible!
when the player punches, the punch can be again and again before its even ended -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i have tried using wait, and animation stop between and during it, but it isn’t seam to work, I’ve also searched a little bit on here for a resolution
What is your script for this supposed punching system?
local tool = script.Parent
local IdleAnim = Instance.new("Animation")
IdleAnim.AnimationId = "rbxassetid://8273807964"
local firstTrack
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://8273972060"
local track
local plr = game.Players.LocalPlayer
local player = tool.Parent:IsA("Model") and game.Players:GetPlayerFromCharacter(tool.Parent) or tool.Parent.Parent
local char = player.Character or player.CharacterAdded:Wait()
tool.Equipped:Connect(function()
firstTrack = script.Parent.Parent.Humanoid:LoadAnimation(IdleAnim)
firstTrack.Priority = Enum.AnimationPriority.Action
firstTrack.Looped = false
firstTrack:Play()
wait(5)
end)
tool.Activated:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
track:Play()
track.Stopped:Wait()
wait(1)
end)
tool.Unequipped:Connect(function()
if firstTrack then
firstTrack:Stop()
end
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)
this is the animation script i use on the tool
Why is there a Wait() after track.Stopped
I presume you mean a cooldown you need to do this:
local cooldown = false
if cooldown == false then
cooldown = true
--put your punching code here
task.wait() -- put your cooldown time in the brackets
cooldown = false
end
Yeah that seems like that would work, im pretty sure that is his solution.
yeah i use that on another script inside the tool to fire the animation
local cooldown = false
tool.Equipped:Connect(function()
if cooldown == false then
cooldown = true
firstTrack = script.Parent.Parent.Humanoid:LoadAnimation(IdleAnim)
firstTrack.Priority = Enum.AnimationPriority.Action
firstTrack.Looped = false
firstTrack:Play()
wait(5)
cooldown = false
end
end)
tool.Activated:Connect(function()
if cooldown == false then
cooldown = true
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
track:Play()
track.Stopped:Wait()
wait(1)
cooldown = false
end
end)
like this
character limitation
local plr = game.Players.LocalPlayer
local event = game.ReplicatedStorage.AddStrength
local cooldown = false
script.Parent.Activated:Connect(function()
if script.Parent:WaitForChild("isEquipped").Value == false then
while wait() do
if cooldown == false then
cooldown = true
event:FireServer(1*plr:WaitForChild("Multi").Value, "+")
script.Disabled = true
wait(1)
script.Disabled = false
if script.Parent:WaitForChild("isEquipped").Value == false then
cooldown = true
end
end
end
end
end)
this where it comes from