Help With Filtering Enabled

Hello! I am currently making a punching script for a game but it seems I have run into a little problem.

For some reason Filtering Enabled is making the script only client sided, meaning it wont actually do anything.

I have turned off Filtering Enabled in the properties window in the workspace, it still doesn’t work.

Any help is much appreciated, this is probably a simple issue to fix.

Here is the code, I am using this in a local script inside of StarterCharacterScripts.

-- Script Written By NotDerpyDemon --


local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.F then

		
		local Player = game.Players.LocalPlayer 
		local Character = Player.Character
		local Humanoid = Character:WaitForChild("Humanoid")

		local Animation = Instance.new("Animation")
		Animation.AnimationId = "rbxassetid://6235346290" 

		local Track = Humanoid:LoadAnimation(Animation)
		Track:Play()
		
		local playing = true
		
		while playing == true do
			wait(0.1)
			local ra = script.Parent:FindFirstChild("Right Arm")
			ra.Touched:Connect(function(hit)
				if hit.Parent:FindFirstChild("Humanoid") then
					if playing == true then
						hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 5
						local s = Instance.new("Sound")
						s.Parent = ra
						s.Volume = (10)
						s.Playing = true
						s.SoundId = ("rbxassetid://3932505023")
						playing = false
					end				
				end
			end)
		end
	end	
end)

Humanoid:LoadAnimation() is deprecated, use Animator:LoadAnimation()

1 Like

What is the animator though? Sorry, I am a little new to scripting.

You can read more about it here:
https://developer.roblox.com/en-us/api-reference/function/Animator/LoadAnimation

It looks like you already added an animation. Now what you want to do is, instead of loading it on the Humanoid, load it on the Animation itself.

local Animator = Humanoid:FindFirstChildOfClass("Animator")
local Track = Animator:LoadAnimation(Animation)
1 Like

Thank you! it is working now. Appreciate the help!