I am working on a sign weapon, but the animation for it is not working. It said the animation was loaded when I tried checking to see if its loaded, but when I try playing it, nothing is happening. I put in an ID and it never said anything about it failing to load. Here are the scripts:

Client:

--Global Variables
local player = game.Players.LocalPlayer
local sign = script.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local handle = sign:WaitForChild("Handle")
local equipped = false
local mouseDown = false

--Folders
local Animations = sign:WaitForChild("Animations")
local RemoteEvents = sign:WaitForChild("RemoteEvents")
local Configurations = sign:WaitForChild("Configurations")

--Animations
local QuickSlashAnim = Animations:WaitForChild("QuickSlash")

--Animation Tracks
local QuickSlashTrack

--Remote Events
local AttackZombie = RemoteEvents:WaitForChild("Attack")
local Play = RemoteEvents:WaitForChild("Play")

--Configurations
local Damage = Configurations:WaitForChild("Damage")
local CanDamage = Configurations:WaitForChild("CanDamage")


local function unequipSign()
	equipped = false
	
	if QuickSlashTrack then
		Play:FireServer(false)
	end
end

local function onSlashed(part)
	AttackZombie:FireServer(part)
end

sign.Equipped:Connect(function()
	equipped = true
	
	mouse.Button1Up:Connect(function()
		mouseDown = false
	end)
		
	sign.Activated:Connect(function()
		mouseDown = true
		Play:FireServer(true)
	end)
end)

sign.Unequipped:Connect(function()
	equipped = false
end)

sign.Sign.SignHead.Touched:Connect(onSlashed)

Server:

--Global Variables
local player
local sign = script.Parent.Parent
local handle = sign:WaitForChild("Handle")

--Folders
local Configurations = sign:WaitForChild("Configurations")
local RemoteEvents = sign:WaitForChild("RemoteEvents")
local Animations = sign:WaitForChild("Animations")

--Animations
local QuickSlashAnim = Animations:WaitForChild("QuickSlash")

--Animation Tracks
local QuickSlashTrack

--Remote Events
local AttackZombie = RemoteEvents:WaitForChild("Attack")
local Play = RemoteEvents:WaitForChild("Play")

local function hitReceived(plr, part)
	local humanoid = part:FindFirstChild("Zombie")
	local damage = Configurations:WaitForChild("Damage")
	
	if humanoid then
		humanoid:TakeDamage(damage.Value)
	end
end

local function playAnimation(player, bool)
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:FindFirstChild("Humanoid")
	
	if humanoid then
		local success, notSuccess = pcall(function()
			QuickSlashTrack = humanoid:LoadAnimation(QuickSlashAnim)
			QuickSlashTrack.Priority = Enum.AnimationPriority.Movement
		end)
	end
	
	if bool then
		QuickSlashTrack:Play()
	else
		QuickSlashTrack:Stop()
	end
end

AttackZombie.OnServerEvent:Connect(hitReceived)
Play.OnServerEvent:Connect(playAnimation)

1 comment

0

Try and see if you are using an r6 animation for an r15 model, and vice versa.