So I am creating this new swordfighting game, and basically I am making it so when you walk on a pad where you swordfight, you're given a linked sword.
And also, when you go to the grass to get off the pad, the sword is removed from your inventory which is what is expected and is normal.
However, when I try and swing the sword when I am on the pad, there is nothing happening. No lunging or sounds.
Here is the localscript code for when a player walks on the swordfighting pad to swordfight
local part = game.Workspace.Pad
local player = game.Players.LocalPlayer
local sword = game.ReplicatedStorage.ClassicSword
part.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
game.ReplicatedStorage["ClassicSword"]:Clone().Parent = player.Backpack
end
end)
This code here is the main issue.
Any help is really appreciated.
P.S. I'm new to scripting.

2 comments
I am also going to add a debounce now.
Because the sword does not exist on the server, only on the client as you cloned in a local script. Just move the code into a server script. "player" would be game.Players:GetPlayerFromCharacter(hit.Parent).