- what the code is supposed to do - equip and unequip sword
- what the code is actually doing - its equipping unequipping only one time but then it isnt working
- the code itself- local script that fires the event to say the server script make sword equip unequip
local UIS = game:GetService("UserInputService")
local Bool = game.ReplicatedStorage:WaitForChild("Equipped") Bool = false local equipped = false
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
if equipped == false then
equipped = true
game.ReplicatedStorage.SwordEquipped:FireServer()
print("true")
else
equipped = false
game.ReplicatedStorage.SwordUnEquipped:FireServer()
print("false")
end
end
end)
server script -
local Bool = game.ReplicatedStorage:WaitForChild("Equipped") local sword = game.ServerStorage.Sword:Clone()
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
game.ReplicatedStorage.SwordEquipped.OnServerEvent:Connect(function()
sword.Parent = character
local handle = sword:WaitForChild("WeldPart")
local Weld = Instance.new("Weld", sword)
Weld.Name = "Weld"
Weld.Part0 = handle
Weld.Part1 = character["Right Arm"]
end)
game.ReplicatedStorage.SwordUnEquipped.OnServerEvent:Connect(function()
sword:Destroy()
end)
end)
end)
- errors/warnings/prints in the output- The Parent property of Sword is locked, current parent: NULL, new parent YellowFirecantdielol"

2 comments
worked
If it helped, accept my answer so I can get them sweet, sweet rep points.