Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[unanswered] EquipTool not working properly and not working at all outside of studio?

i disabled the backpack gui and i want to use EquipTool() to have a specific player equip a tool.


wait(5)
local randomPlayer = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]

 randomPlayer.TeamColor = BrickColor.new("Really black")

 randomPlayer.character.LowerTorso.CFrame = CFrame.new(workspace.KillerSpawn.Position)
 randomPlayer.character.Head.face.Texture = 'http://www.roblox.com/asset/?id=2383072347'
 randomPlayer.character.Head.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.LeftFoot.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.LeftHand.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.LeftLowerArm.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.LeftLowerLeg.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.LeftUpperArm.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.LeftUpperLeg.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.LowerTorso.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.RightFoot.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.RightHand.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.RightLowerArm.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.RightLowerLeg.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.RightUpperArm.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.RightUpperLeg.BrickColor = BrickColor.new("Really black")
 randomPlayer.character.UpperTorso.BrickColor = BrickColor.new("Really black")

 randomPlayer.character.Humanoid:RemoveAccessories()

 randomPlayer.character.Shirt:Destroy()
 randomPlayer.character.Pants:Destroy()

 randomPlayer.character.Humanoid:EquipTool(game.StarterPack.Katana)

this works, up until the equiptool part. it only equips the tool. it doesnt function at all (like it doesnt attack) and when i tried it outside of studio it doesnt even equip it at all. PLEASE help me with this i really need it and ive tried all day and not a single person has actually helped me out on this

also, its a regular script in serverscriptservice

6 comments

0

If you want to use EquipTool(), then why aren't you using it? Why are you trying to clone the tool to the character?

0

crap, i just realized this is the older script oh my god, here i will fix it

0

You shouldn't really use EquipTool() to equip a tool from the StarterPack. You should equip the tool from the player's Backpack using the code you can find in my answer.

0

Wait, how would I get the tool into the player's backpack? Sorry for being stupid I'm just sorta new at this

0

It's no problemo, amigo. The tool is automatically cloned into the player's Backpack when you put it in StarterPack in Studio. The Backpack is inside of the player itself, and is where the tools in the player's inventory, so to speak, are stored. For example, when in game and you see the tools at the bottom of the screen, you are looking at the tools that are in the player's Backpack.

0

OH. Well, I used what you showed me (but I replaced player with my randomPlayer variable ofc) and it still had the same result, it equipped it and placed it in my hand, but didn't attack or function at all and yet again doesn't even equip outside of studio.

1 answer

✓ Accepted answer

If you want to force equip a tool, you must use EquipTool() on the player's humanoid using the tool you want to equip as the argument. Also, the Character property is spelled with a capital C, not a lowercase c. Please fix it. In your case, you'd use the following snippet of code to accomplish this:

player.Character.Humanoid:EquipTool(player.Backpack.Katana)

You can find more information on EquipTool() here: https://www.robloxdev.com/api-reference/function/Humanoid/EquipTool

5 comments

0

Also, if you have already tried this and it still didn't work, the problem may lie in the tool itself. The equipping of the tool would have nothing to do with how it functions while equipped. If the tool is from the toolbox, it may be in some way broken by FilteringEnabled, which may explain why it works in studio but not in game.

0

Before I disabled the backpack gui and everything I tested it out in StarterPack like a normal tool and everything worked fine, it doesn't function at all if i use EquipTool to equip it, it only puts it in my hand and outside of studio it doesnt work at all

0

I don't see why that would happen. Try using the code I have in my answer and see if it works.

0

okay, a day later i figured out that my sword i made was not compatible with FE, though it still somehow worked the first day i tested it. i used this, and it worked fine after i remade the sword.

0

Lol. Happy it works now.

This discussion is preserved as it was. New answers, comments, and votes are closed.