My armour equip script isnt removing the tool

local script:

local tool = script.Parent
local RE = game:GetService("ReplicatedStorage")
local ArmorEvent = RE.ArmorEvent
local name = "Helm"
local Atype = "Head"
tool.Activated:Connect(function()
	ArmorEvent:FireServer(name,Atype)
end)

Script:

local RE = game:GetService("ReplicatedStorage")
local ArmorEvent = RE.ArmorEvent
local ArmorModel = RE.ArmorModel
local ArmorTool = RE.ArmorTool

ArmorEvent.OnServerEvent:Connect(function(plr,name,Atype)
	print(name)
	if Atype == "Head" then 
		for i, v in pairs(plr.Backpack:GetChildren()) do 
		if v.Name == name then
v:Destroy()
		end	


				
				if name == "Helm" then
					if plr.Backpack:FindFirstChild("Helm")then 
					end
					
					plr.Character:WaitForChild("Humanoid").WalkSpeed = 30
					local HelmModel = ArmorModel:WaitForChild("Helm")


				end	

				if name == "Sigil" then
					plr.Character:WaitForChild("Humanoid").WalkSpeed = 3
					local SigilModel = ArmorModel:WaitForChild("Sigil")
					local weld = Instance.new("WeldConstraint",SigilModel.PrimaryPart)
					local head = plr.Character:WaitForChild("Head")
					weld.Part0 = head
					weld.Part1 = SigilModel.PrimaryPart

				end	
			
		
		end
		
		
		end
	end)



The issue im having with this code is that it just doesnt get rid of the item that activated the remote event. I tried fixing it but rather then working (as intended) it got rid of all other items beside the helmet tool i activated. Any feedback will be nice

When the player equips a tool, it is no longer located in the player’s backpack, and is instead in the player’s character!

You can either expand your loop to include the player’s character, or you could even pass the tool as a parameter of the remote event, allowing you to access itt directly.

1 Like

That… actually works! Thank you!

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