Armor script does weird glitch

Hello,

Whenever I purchase an armor piece from the shop in my game, this weird bug happens:
weirdglitch
Here’s the client sided script:

local purchased = false
local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local button = vp:WaitForChild("PurchaseArmor")
button.MouseButton1Click:Connect(function()
	if not purchased then
		purchased = true
		button.Text = "Purchased"
		button.BackgroundColor3 = Color3.fromRGB(54, 54, 54)
		local purchaseEvent = game:GetService("ReplicatedStorage"):WaitForChild("ArmorPurchase")
		local humanoid = char:WaitForChild("Humanoid")
		purchaseEvent:FireServer(armor,char,hrp,humanoid)
	end
end)

The server sided script:

local event = game:GetService("ReplicatedStorage"):WaitForChild("ArmorPurchase")
local MAX_TANK_HEALTH = 150
event.OnServerEvent:Connect(function(plr,armor,char,hrp,humanoid)
	local purchasedArmor = armor:Clone()
	purchasedArmor.Parent = char
	local armorEquipM6D = purchasedArmor:WaitForChild("HumanoidRootPart"):WaitForChild("ArmorEquip")
	armorEquipM6D.Part1 = hrp
	humanoid.MaxHealth = MAX_TANK_HEALTH
	humanoid.Health += MAX_TANK_HEALTH
end)

Help is appreciated.

nevermind, i fixed the problem. i was cloning the hrp of the armor and not the actual armor

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.