Help with kit script

So i have this script, which parent is TextButton you’re supposed to click in order to activate it, it’s supposed to give the character armor and a weapon (and also modify their stats a bit, so it appears as armor is actually doing something), even though i tried everything i could, it just won’t work, if it equipped armor, but not sword, i could narrow it down, but in this case it equips neither, so as my last resort, i thought i’d take this issue to devforum, because i legit have no idea where i went wrong with this.
Here’s the script (it’s an ordinary script):

local click = script.Parent
local storage = game:GetService("ReplicatedStorage")
local model = storage.HeavyArmor
local part = model.MainPart

click.MouseClick:Connect(function(player)
	if click.MouseButton1Click then
	local character = player.Character or player.CharacterAdded:Wait()
	local hrp = character:WaitForChild("HumanoidRootPart")
	local root = hrp:WaitForChild("RootAttachment")

	local modelClone = model:Clone()
	modelClone.Parent = character
	local ModelMainPart = modelClone:WaitForChild("MainPart")
	ModelMainPart.CanCollide = false
	local Joint = Instance.new("RigidConstraint")
	Joint.Parent = character
	Joint.Attachment0 = root
	Joint.Attachment1 = ModelMainPart.ArmorPoint
	local H = character:WaitForChild("Humanoid")
	H.MaxHealth = 1000
	H.Health = 1000
	H.WalkSpeed = 10
	local Inventory = game.Players.PlayerName.Backpack
	local Sword = game.ReplicatedStorage.HeavySword:Clone()
	Sword.Parent = Inventory
	end
end)

That’s because this is done locally. You have to use remote events and do the logics in the server.

With my understanding in scripting, i moved the assets to ServerStorage and wrote a new iteration of script, this time a ModuleScript:

local ArmorEquipper = {}
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local Armor = ServerStorage.Assets.HeavyArmor
local Sword = ServerStorage.Assets.HeavySword
local Button = game.StarterGui.ScreenGui.Heavy
local function onClicked(player)
	if Button.MouseButton1Click then
	player:LoadCharacter()
	local character = player.Character or player.CharacterAdded:Wait()
	local hrp = character:WaitForChild("HumanoidRootPart")
	local a = hrp:WaitForChild("RootAttachment")
	local H = character:WaitForChild("Humanoid")
	local sword = Sword:Clone()
	sword.Parent = character
	local armor = Armor:Clone()
	armor.Parent = character
	local r = Instance.new ("RigidConstraint")
	r.Parent = character
	r.Attachment0 = a
	r.Attachment1 = armor.MainPart.ArmorPoint
	H.MaxHealth = 1000
	H.Health = 1000
	H.WalkSpeed = 10
	end
end
Button.MouseButton1Click:Connect(onClicked)
return ArmorEquipper

Yet, this one still fails, there must be something i’m doing wrong here, any help is appreciated.
(i also may come back to edit it as i realize some of the minor mistakes)

Yeah, you have to use remoteevents. They are very easy to use, check out my LOCALscript :

local button = script.Parent --The button itself
local gun = game.Workspace["Blender-Tech-Aug-2"] --You need the gun you want to clone
local plr = game.Players.LocalPlayer --And the player

local gunEvent = game.ReplicatedStorage.AUG

	button.MouseButton1Click:Connect(function() --If triggered
	gunEvent:FireServer(gun) --It will fire the remoteevent with the argument "gun", the weapon we want to clone
end)

The ServerScript :

local gunEvent = game.ReplicatedStorage.AUG -- The RemoteEvent

	gunEvent.OnServerEvent:Connect(function(plr, tool) --If triggered, then we set 2 arguments. First is the player argument, that will be always the first when getting the data from the RemoteEvents, the 2nd one will be our argument called gun in the localscript
	local toolClone = tool:Clone() --Cloning the tool
	toolClone.Parent = plr.Backpack --And put it inside of the player's backpack. If you want to give it to his hand immediately, say 'toolClone.Parent = plr.Character'
end)

That solves it, thank you so much, i’ll take it from here.