im making a sword combat system and i made a table for 4 of the animations but only the first animation is playing i checked it over mutiple times and changed stuff and still nothing```lua
local rp = game:GetService(“ReplicatedStorage”)
local combatevent = game.ReplicatedStorage.SwordCombat:WaitForChild(“PlayerCombat”)
local animation = script:WaitForChild(“Animations”)
local acutalplayer = game:GetService(“Players”)
local CollectionService = game:GetService(“CollectionService”)
local tweenService = game:GetService(“TweenService”)
local ALIVE_TAG_NAME = “Punch”
local anims = {
animation:WaitForChild(“Slash1”),
animation:WaitForChild(“Slash2”),
animation:WaitForChild(“Slash3”),
animation:WaitForChild(“Slash4”)
}
combatevent.OnServerEvent:Connect(function(player,count)
print(“Recieved event”)
local character = player.Character
local Hum = character:WaitForChild(“Humanoid”)
spawn(function()
Hum.WalkSpeed = 10
wait(2)
Hum.WalkSpeed = 16
end)
local clash = Instance.new("BoolValue")
clash.Name = "ClashAttack"
clash.Value = false
clash.Parent = player.Character
game.Debris:AddItem(clash,0.4)
local dodge = {5491816196,5491829124,5491834231}
local num = math.random(#dodge)
local chosenanim = dodge[num]
local attack = Hum:LoadAnimation(anims[count])
attack:Play()
combatevent:FireClient(player)
3 Likes
if it helps any this is it in game Streamable Video
In the animation, attempt doing this.
-
Open the animation editor and select your dummy.
-
Hit the dropdown menu
- Set animation priority to “Action”
- Bazinga
1 Like
alrighty i will try it thanks man
I think you didn’t show the LocalScript, as I noticed you’re sending the animation count from the client with a RemoteEvent. Please show the piece of code that switches the animations.
local UIS = game:GetService("UserInputService")
local debounce = false
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
Character = Player.Character
local cd = .6
local count = 0
local currTime = 0
local prevTime = 0
local combat = game.ReplicatedStorage.SwordCombat:WaitForChild("PlayerCombat")
local debounce2 = false
local tool = script.Parent
local tweenService = game:GetService("TweenService")
local punch2 = game.ReplicatedStorage.SwordCombat:WaitForChild("Punch2Player")
script.Parent.Activated:Connect(function(isTyping)
if isTyping then return end
if Player.Character:FindFirstChild("Hit") then return end
if Player.Character:FindFirstChild("Blocking") then return end
if debounce == false then
debounce = true
currTime = tick()
local passedTime = currTime - prevTime
if passedTime < 1 then
print("its less that one")
count = count + 1
print(count)
if count > 4 then
count = 1
end
else
count = 1
end
combat:FireServer(count)
print("fired")
end
end)
combat.OnClientEvent:Connect(function()
prevTime = currTime
if count == 4 then
wait(2)
debounce = false
else
wait(0.5)
debounce = false
end
end)
tool.Equipped:Connect(function(Mouse)
Mouse.Button2Down:Connect(function()
if Player.Character:FindFirstChild("Hit") then return end
if Player.Character:FindFirstChild("Blocking") then return end
repeat wait() until Player.Character
local Character2 = Player.Character
local head = Character2:WaitForChild("HumanoidRootPart")
print(Character2.Name)
if not debounce2 then
debounce2 = true
local effect = game.ReplicatedStorage.SwordCombat:WaitForChild("RMAttack"):Clone()
effect.CFrame = head.CFrame
effect.Parent = workspace
game.Debris:AddItem(effect,0.7)
local info3 = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local goal3 = {}
goal3.Size = effect.Size * 0.5
goal3.Transparency = 1
local tween3 = tweenService:Create(effect,info3,goal3)
tween3:Play()
print("played3")
print("activated m2 ")
punch2:FireServer()
wait(3)
debounce2 = false
end
end)
end)
If this was the solution, please mark it as such. This will aid users in the future who have the same issue.