NotZylon
(shiesty)
April 20, 2021, 12:52pm
#1
So im trying to equip a tool but it’s not working why? Here’s part of the code
remotes.Equip.OnServerEvent:Connect(function(player, item, ItemType, condition)
local selecteditem = game.ServerStorage.Equipment[item]:Clone()
player.Character.Humanoid:EquipTool(selecteditem)
end)
Thank you
2 Likes
Any errors?
If not, how are you firing the event? What does the FireServer
look like?
1 Like
NotZylon
(shiesty)
April 20, 2021, 12:57pm
#3
remotes.Equip:FireServer(items.Name, items.ItemType.Value, "Equipped")
Im not having any errors
1 Like
Right now when you try it out, what happens? It just doesn’t equip you the tool or does something else happen? Add a print statement in the OnServerevent to see if it’s receiving the FireServer
1 Like
NotZylon
(shiesty)
April 20, 2021, 1:00pm
#5
i added a print and the print printed, but it just doesn’t equip
1 Like
Try putting the folder in ReplicatedStorage and try this out?
remotes.Equip.OnServerEvent:Connect(function(player, item, ItemType, condition)
local selecteditem = game:GetService("ReplicatedStorage").Equipment[item]
player.Character.Humanoid:EquipTool(selecteditem:Clone())
end)
Otherwise maybe try this first?
remotes.Equip.OnServerEvent:Connect(function(player, item, ItemType, condition)
local selecteditem = game:GetService("ServerStorage").Equipment[item]
player.Character.Humanoid:EquipTool(selecteditem:Clone())
end)
Just ot be clear, did you add the print before the FireServer
or in the OnServerEvent
, something like this?
remotes.Equip.OnServerEvent:Connect(function(player, item, ItemType, condition)
print("Test")
local selecteditem = game:GetService("ServerStorage").Equipment[item]
player.Character.Humanoid:EquipTool(selecteditem:Clone())
end)
Cause it could be that it’s not reaching the event?
That’s odd, it’s probably something else? What’s in your Equipment folder?
NotZylon
(shiesty)
April 20, 2021, 1:20pm
#11
i fixed the problem, i just parented the tool to the character instead. Thanks for the help
1 Like
Wqund
(p1rate)
April 20, 2021, 1:33pm
#12
You need to parent the tool before equipping it, parent it to the player’s backpack
3 Likes
msix29
(msix29)
July 10, 2022, 9:27pm
#14
Tool.Parent = player.Backpack
Humanoid:EquipTool(Tool)
--you cant equip a tool that isn't in your inventory right?
3 Likes
I’m not sure if this is your case but
If this property RequiresHandle
is on, but you don’t have a Part called Handle inside the tool it won’t equip
Also try parenting the tool to the workspace before trying to equip it