this issue has really stumped me. The animations won’t stop playing even if looped is false and it only loops to other players (only other people can see it loop, whereas it doesnt show on your screen), which makes me believe it is some sort of client issue?
the issue in more depth: the other player would trigger the animation and it wont stop playing, and if you were to trigger the animation it would stop playing only for you, it would be the other way around for any other players.
this code is in a local script in a folder in StarterCharacterScripts.
local uis = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
local rs = game:GetService("ReplicatedStorage")
local players = game.Players
local swing1 = "rbxassetid://13412718677"
local swing2 = "rbxassetid://13412723276"
local swing3 = "rbxassetid://13412730509"
local runSwing1 = "rbxassetid://13540095061"
local runSwing2 = "rbxassetid://13540133147"
local runSwing3 = "rbxassetid://13540160734"
local block = "rbxassetid://13554222408"
local blockHit = "rbxassetid://13555440555"
local player = players.LocalPlayer
local c = script.Parent.Parent
local hrp = c:WaitForChild("HumanoidRootPart")
local combat = rs.remotes.combat
local flameFolder = rs.nichirins.flame
local anim = script:WaitForChild("Animation")
local anim2 = script:WaitForChild("Animation2")
local anim3 = script:WaitForChild("Animation3")
local anim4 = script:WaitForChild("Animation4")
local anim5 = script:WaitForChild("Animation5")
local anim6 = script:WaitForChild("Animation6")
local animB = script:WaitForChild("AnimationB")
local animB2 = script:WaitForChild("AnimationB2")
local combo = 1
local lastHit = 0
local cd = false
local blocking = false
anim.AnimationId = swing1
local load = c.Humanoid:LoadAnimation(anim)
anim2.AnimationId = swing2
local load2 = c.Humanoid:LoadAnimation(anim2)
anim3.AnimationId = swing3
local load3 = c.Humanoid:LoadAnimation(anim3)
anim4.AnimationId = runSwing1
local load4 = c.Humanoid:LoadAnimation(anim4)
anim5.AnimationId = runSwing2
local load5 = c.Humanoid:LoadAnimation(anim5)
anim6.AnimationId = runSwing3
local load6 = c.Humanoid:LoadAnimation(anim6)
animB.AnimationId = block
local loadB = c.Humanoid:LoadAnimation(animB)
animB2.AnimationId = blockHit
local loadB2 = c.Humanoid:LoadAnimation(animB2)
local function setupChar(char)
local handle = flameFolder.Handle:Clone()
handle.Parent = char
local m6d = Instance.new("Motor6D", handle)
m6d.Part0 = char:WaitForChild("Right Arm")
m6d.Part1 = handle
m6d.C1 = CFrame.new(0, 1, 0)
local model = flameFolder["Meshes/rengokusKatana2 (2)"]:Clone()
model.Parent = workspace.nichirins
local weld = Instance.new("Weld", model)
weld.Part0 = handle
weld.Part1 = model
weld.C1 = CFrame.new(0, -2.5 ,0) * CFrame.Angles(math.rad(90), 0, 0)
end
for i, v in pairs(players:GetChildren()) do
repeat wait() until v.Character
setupChar(v.Character)
v.CharacterAdded:Connect(function(char)
char:WaitForChild("Right Arm")
setupChar(char)
end)
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
setupChar(char)
char:WaitForChild("Right Arm")
end)
end)
local function slash(char, comboN)
if char == c then
local hb = Instance.new("Part", workspace.Fx)
hb.Size = Vector3.new(5,3,7)
hb.CFrame = hrp.CFrame * CFrame.new(0,0,-5)
hb.Anchored = true
hb.CanCollide = false
hb.Transparency = .6
hb.Name = "hb"
hb.Material = Enum.Material.ForceField
hb.CanQuery = false
local con
con = hb.Touched:Connect(function()
con:Disconnect()
end)
local hits = {}
for i,v in pairs(hb:GetTouchingParts()) do
if v:IsDescendantOf(char) == false then
if v.Parent:FindFirstChildWhichIsA("Humanoid") and table.find(hits, v.Parent) == nil then
table.insert(hits, v.Parent)
end
end
end
local data = {hb = hits, action = "hit", combo = comboN, c = char, parry = blockHit}
combat:FireServer(data)
hb:Destroy()
end
end
uis.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 and cd == false and c:FindFirstChild("Stun") == nil then
c.Humanoid.JumpHeight = 0
if tick() - lastHit < 1 then
combo = 1
end
lastHit = tick()
cd = true
if combo == 1 then
load.Looped = false
load:Play()
wait(1)
load:Stop()
combo = 2
elseif combo == 2 then
load2.Looped = false
load2:Play()
wait(1)
load2:Stop()
combo = 3
elseif combo == 3 then
load3.Looped= false
load3:Play()
wait(1)
load3:Stop()
combo = 1
end
local data = {char = c, comboN = combo, action = "slash"}
combat:FireServer(data)
slash(c, combo)
wait(.1)
cd = false
c.Humanoid.JumpHeight = 7.2
elseif input.UserInputType == Enum.UserInputType.MouseButton2 and cd == false and c:FindFirstChild("Stun") == nil then
loadB:Play()
blocking = true
local data = {char = c, action = "block"}
combat:FireServer(data)
repeat
wait(.1)
until blocking == false
loadB:Stop()
end
end)
uis.InputEnded:Connect(function(input, gpe)
if input.UserInputType == Enum.UserInputType.MouseButton2 and blocking then
blocking = false
local data = {char = c, action = "unblock"}
combat:FireServer(data)
end
end)