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

UnequipTools unequips a tool but then equips it again?

I have this portion of my script:

local player = hit.Parent --It's a character, not an actual player.
player:WaitForChild("Humanoid"):UnequipTools()
			wait(.1)

for i,v in pairs(game.Players:GetPlayerFromCharacter(player).Backpack:GetChildren()) do
				if v.ClassName == "Tool" then
					v.Parent = player:WaitForChild("Saved_Weapons")
				end
			end

The problem here is that the script unequips all the tools in the character but for some reason the tool decides to come back to the character and not to the "Saved_Weapons" folder.

Why is this happening? Am I missing something?

Any help is appreciated!

Ty <3

2 comments

0

You could try setting its parent in saved_weapons folder each time? or something like if not blah.Parent then or if ~= blah.Parent then. If you get my drift. (sorry im terrible at scripting lol)

0

That would not change anything ;C

1 answer

✓ Accepted answer

It says that the Saved_Weapons folder is in the character, because player is a reference to the character, and when a tool is put into a roblox character it automatically equips the weapon (even in a object thats inside of the character).

So in order to fix this, try and moving the folder to another place besides the character.

1 comment

0

If this was the answer, make sure to make this the answered question.

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