local Tool = script.Parent
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
while not Character or not Character.Parent do
Character = Player.Character
wait()
end
local Value = Tool:WaitForChild("Values")
local Blocking = Value:WaitForChild("Equipped")
local Equipped = Value:WaitForChild("Blocking")
local Humanoid = Character:WaitForChild("Humanoid")
local DebrisService = game:GetService("Debris")
local AnimsFold = Tool:WaitForChild("AnimFolder")
local AnimsSlash = AnimsFold:WaitForChild("Slashes")
local anims = {
Equip = Humanoid:LoadAnimation(AnimsFold:WaitForChild("Equip")),
Idle = Humanoid:LoadAnimation(AnimsFold:WaitForChild("Idle")),
Blocking = Humanoid:LoadAnimation(AnimsFold:WaitForChild("Blocking")),
Slash1 = Humanoid:LoadAnimation(AnimsSlash:WaitForChild("S1")),
Smash = Humanoid:LoadAnimation(AnimsSlash:WaitForChild("Smash")),
}
local Animplay = Tool.Events:WaitForChild("AnimPlay")
local AtteckE = Tool.Events:WaitForChild("Attack")
local Debounce = false
local CanDamage = false
Tool.Equipped:Connect(function()
print("eq")
Character = Tool.Parent
Equipped.Value = true
Debounce = true
Tool.Tool6D.Part0 = Character["Right Arm"]
Tool.Tool6D.Part1 = Tool.Handle
Animplay:FireAllClients(anims.Equip:Play())
Animplay:FireAllClients(anims.Idle:Play())
wait(1)
Debounce = false
end)
Firstly you can’t get LocalPlayer in a server script
Secondly this doesn’t even make any sense at all, this on the client will become nil
I suggest just doing the animations locally like this:
-- LOCAL SCRIPT
local Tool = script.Parent
local Players = game:GetService("Players")
local Player = Players:GetPlayerFromCharacter(Tool.Parent) or Tool.Parent.Parent
--[[ detect if tool is equipped or not:
if tool is in the character then we can get player from their character using Players:GetPlayerFromCharacter
however if tool is in backpack (which is child of player) then the function above will return nil, instead we just get the backpack's parent
]]
local Character = Player.Character or Player.CharacterAdded:Wait()
while not Character or not Character.Parent do
Character = Player.Character
wait()
end
local Value = Tool:WaitForChild("Values")
local Blocking = Value:WaitForChild("Equipped")
local Equipped = Value:WaitForChild("Blocking")
local Humanoid = Character:WaitForChild("Humanoid")
local DebrisService = game:GetService("Debris")
local AnimsFold = Tool:WaitForChild("AnimFolder")
local AnimsSlash = AnimsFold:WaitForChild("Slashes")
local anims = {
Equip = Humanoid:LoadAnimation(AnimsFold:WaitForChild("Equip")),
Idle = Humanoid:LoadAnimation(AnimsFold:WaitForChild("Idle")),
Blocking = Humanoid:LoadAnimation(AnimsFold:WaitForChild("Blocking")),
Slash1 = Humanoid:LoadAnimation(AnimsSlash:WaitForChild("S1")),
Smash = Humanoid:LoadAnimation(AnimsSlash:WaitForChild("Smash")),
}
local Animplay = Tool.Events:WaitForChild("AnimPlay")
local AtteckE = Tool.Events:WaitForChild("Attack")
local Debounce = false
local CanDamage = false
Tool.Equipped:Connect(function()
if debounce then return end -- if debounce is true then prevent animation from running
print("eq")
Character = Tool.Parent
Equipped.Value = true
Debounce = true
Tool.Tool6D.Part0 = Character["Right Arm"]
Tool.Tool6D.Part1 = Tool.Handle
anims.Equip:Play()
anims.Idle:Play()
-- simply plays the animation, no FireAllClients stuff
task.wait(1) -- wait is deprecated, task.wait does its job better
Debounce = false
end)
Have you made sure that all the animation objects you want to play from contains an AnimationId? If not then insert the animation ids you want to play into the animationId property of those objects (you must own the animations)
Also I think your game is hacked, there’s a bunch of random scripts attempting to use loadstring (dangerous command), there’s even a animation spoofer script which might clear your animations. It could come from a free model or a plugin, try and remove them
Do you have them on all of the animation objects you tried to load in (5 of those you used in the script), if you don’t then temporarily remove the lines you don’t need to load animations yet from the script, only keep the ones you’re testing
Try to disable your plugins one by one to see which one is inserting hacks then delete suspicious plugins from your inventory, and check models in your game and delete unknown scripts