I'm working on a sign weapon, and I loaded the animation and everything. The script says the animation is running, but nothing is happening. This was done on a local script.

Script:

--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")

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

local function equipSign()
	equipped = true
	
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:FindFirstChild("Humanoid")
	
	if humanoid then
		pcall(function()
			QuickSlashTrack = humanoid:LoadAnimation(QuickSlashAnim)
		end)
	end
end

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

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

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

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

1 comment

0

Try using it on a regular script. This is because Local scripts are for when you want it to run for the client and not server sided.