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)