So I'm having an issue right now. I'm making a tool (named "Baseball bat") which is unequipped everytime you equip it if it accomplishes a condition. I'll leave what i got:


local t = script.Parent
local handle = t.Handle
local player = t.Parent.Parent.Character
local torso = player.Torso
local RArm = player["Right Arm"]
local hum = player.Humanoid

t.Equipped:Connect(function(mouse)
	--if player:WaitForChild("PlayerSettings").Status ~= "None" then
		hum:UnequipTools()
		return
	--end
	--local weld = createWeld()
end)

However, It doesnt work and returns a yellow output:

18:37:09.721 - Something unexpectedly tried to set the parent of Baseball bat to Backpack while trying to set the parent of Baseball bat. Current parent is SnyFort.

6 comments

0

By any chance, are you deleting the Backapck or changing It's parent?

0

Nope. The error source is from this script for sure

0

I tried something like, instead of using "UnequipTools", to set the players health to 0. When I equipped it It kiled my character. The issue is on UnequipTools

0

This happened to be me before. UnequipTools() is kinda glitchy. Like when you teleport players and remove their tools right away it gives you an error and kicks the player from the game.

0

Yes because unequiptools always parents the tool to the players backpack (the player assigned to the humanoid)

0

I've experienced this before, in a similar scenario to yours. I think it occurs because of the quick parent changing. There is probably a better way to do this, but it worked when I added a wait() before the UnequipTools() function. I don't want to post this as an answer since it's most likely not the best fix.