Each time a player resets or dies they loose their sword. I need this to stop because this is a fighting game and loosing your sword after dying would be really sad.
local Swprd = game.ServerStorage.BackSword local repStorage = game.ReplicatedStorage game.Players.PlayerAdded:Connect(function(plr) local SS = Swprd:Clone() local weldPart = SS.WeldPart local char = plr.Character or plr.CharacterAdded:Wait() local HMR = char.Torso SS.Parent = char local weld = Instance.new("Weld", char) weld.Name = "Welder" weld.Part0 = HMR weld.Part1 = weldPart weld.Parent = weldPart end)
That is the server script for when they enter
local player = game.Players.LocalPlayer local repStorage = game.ReplicatedStorage local playerChar = player.Character or player.CharacterAdded:Wait() local function activate() if not playerChar:FindFirstChild("BackSword") then playerChar.HandSword:Destroy() repStorage.SworBd:FireServer() elseif playerChar:FindFirstChild("BackSword") then playerChar.BackSword:Destroy() repStorage.Sword:FireServer() end end game:GetService("UserInputService").InputBegan:Connect(function(input, isTyping) if isTyping then return end if input.KeyCode == Enum.KeyCode.One then activate() end end)
That is the local script (there are two remotes one that does the same thing as the first script I showed and another remote that gives the player the HandSword)
From what I understand, you're trying to get the sword to weld again after the character respawns.
First ServerScript:
local Swprd = game:GetService('ServerStorage').BackSword local repStorage = game:GetService('ReplicatedStorage') game:GetService('Players').PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) repeat wait() until char and char:FindFirstChild('Torso') local SS = Swprd:Clone() local weldPart = SS.WeldPart local HMR = char.Torso SS.Parent = char local weld = Instance.new("Weld") weld.Name = "Welder" weld.Part0 = HMR weld.Part1 = weldPart weld.Parent = weldPart end) end)