repS:WaitForChild(“Remotes”):WaitForChild(“ItemEquip”).OnServerEvent:Connect(function(player, item, status)
local plrInfo = player:WaitForChild(“PlayerInfo”)
local char = player.Character
local humanoid = char:WaitForChild(“Humanoid”)
if status == true then
if not serverS:WaitForChild("Draggable"):FindFirstChild(item) then warn("add the item into server storage") return end
if not plrInfo:WaitForChild("PlayerInventory"):WaitForChild("Backpack"):FindFirstChild(item) and not plrInfo:WaitForChild("PlayerInventory"):WaitForChild("Hotbar"):FindFirstChild(item) then return end
local tool = serverS:WaitForChild("Draggable"):FindFirstChild(item):Clone()
humanoid:EquipTool(tool)
for i, v in tool:GetChildren() do
if v:IsA("BasePart") and v:FindFirstAncestorOfClass(workspace.Name) then
v:SetNetworkOwner(nil)
v.CanCollide = false
end
end
for i, v in humanoid.Parent:GetChildren() do
if v:IsA("BasePart") then
v:SetNetworkOwner(player)
end
end
else
humanoid:UnequipTools()
end
end)
formatting seems a bit broken, so apologies for that but im not sure how to fix it