I need help so basically I’m trying to find a way to instantly kill an animation in Roblox but the problem is adjustWeight(0) and Stop() doesn’t seems to work well here’s lies the server code of my dips animation killer
game.ReplicatedStorage.CharacterAction.Dips:FireClient(player, player)
CallbackHandler = CurrentPlayer.Humanoid.Changed:Connect(function(property)
if CurrentPlayer ~= nil and property == 'Jump' then
print("RIG JUMPED OUT OF BED")
CurrentPlayer.HumanoidRootPart.Weld:Remove()
--CurrentPlayer.RightHand.Weld:Remove()
local ClonePunch = CurrentPlayer.Punch:Clone()
CurrentPlayer.Punch:Destroy()
ClonePunch.Parent = CurrentPlayer
ClonePunch.Disabled = false
local FollowCamera = CurrentPlayer.FollowCamera:Clone()
CurrentPlayer.FollowCamera:Destroy()
FollowCamera.Parent = CurrentPlayer
FollowCamera.Disabled = false
player.PlayerGui.StatGUI.HealthFrame.ExpCalisthenics.Active = false
player.PlayerGui.StatGUI.HealthFrame.ExpCalisthenics.Visible = false
ClickDetector.MaxActivationDistance = 15
game.ReplicatedStorage.UnbindAction.UnbindPullup:FireClient(player, player)
for i, j in pairs(DipsFolder:GetChildren()) do
for k, l in pairs(j:GetChildren()) do
if l.Name == "DipLeft" then
ShowClickDetector:FireClient(player, l.ClickDetector, 15)
end
end
end
LeaveDips(player.Character)
local CloneDips = CurrentPlayer.Dips:Clone()
CloneDips.Parent = CurrentPlayer
CurrentPlayer.Dips:Destroy()
end
end)
Here’s lies all the client code
local UserInput = game:GetService("UserInputService")
local DipsEvent = game.ReplicatedStorage.CharacterAction.Dips
local CanDips = true
local char = script.Parent
local ReplicatedStorage = game.ReplicatedStorage
local event = ReplicatedStorage.Remotes.AddHealth
local ClickCounter = game.ReplicatedStorage.Click.ClickerCounter
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=15864448315"
local humanoid = char:WaitForChild("Humanoid")
local YourAnimationTrack = humanoid.Animator:LoadAnimation(animation)
DipsEvent.OnClientEvent:Connect(function(currentPlayer)
UserInput.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or (Enum.UserInputType.Touch and UserInput.TouchEnabled) then
if CanDips == true then
CanDips = false
ClickCounter:FireServer(currentPlayer)
YourAnimationTrack.Priority = Enum.AnimationPriority.Action2
YourAnimationTrack:Play()
wait(YourAnimationTrack.Length)
CanDips = true
end
end
end)
end)
game.ReplicatedStorage.UnbindAction.UnbindDips.OnClientEvent:Connect(function(player)
YourAnimationTrack:AdjustSpeed(0)
YourAnimationTrack:Stop()
end)
It seems like I applied the same logic on the pull up bar but it doesn’t seems to work on the dips thing
Paste this code where you put your client code (I adjusted some pieces of the code you sent above):
local UserInput = game:GetService("UserInputService")
local DipsEvent = game.ReplicatedStorage.CharacterAction.Dips
local CanDips = true
local char = script.Parent
local ReplicatedStorage = game.ReplicatedStorage
local event = ReplicatedStorage.Remotes.AddHealth
local ClickCounter = game.ReplicatedStorage.Click.ClickerCounter
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=15864448315"
local humanoid = char:WaitForChild("Humanoid")
local YourAnimationTrack = humanoid:LoadAnimation(animation)
DipsEvent.OnClientEvent:Connect(function(currentPlayer)
UserInput.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or (Enum.UserInputType.Touch and UserInput.TouchEnabled) then
if CanDips == true then
CanDips = false
ClickCounter:FireServer(currentPlayer)
YourAnimationTrack.Priority = Enum.AnimationPriority.Action2
YourAnimationTrack:Play(0)
wait(YourAnimationTrack.Length)
CanDips = true
end
end
end)
end)
game.ReplicatedStorage.UnbindAction.UnbindDips.OnClientEvent:Connect(function(player)
YourAnimationTrack:Stop(0)
end)
Let me know if there are any errors and if this fixes the problem
Animation is still playing until the end once I leave the dips it seems like AnimationTrack is stored in the cache which make it play until the end even tho the animation must have been stopped way long ago