LoadCharacter when Unequip a tool

1- Is it possible to use “player:LoadCharacter()” when unequip a tool?

I will add accessories and clothes in the player when equipping a tool and when to unequip, I want to reset the character.

Can anyone tell me if it’s possible and any idea how to do it?

(It is a SERVER script, btw)

local Players = game:GetService("Players")
local Tool = script.Parent

local Character = nil
local ToolEquipped = false

Tool.Equipped:Connect(function()
	if ToolEquipped then return end 
	ToolEquipped = true
	Character = Tool.Parent
	-- do stuff
end)

Tool.Unequipped:Connect(function()
	Character = Tool.Parent
	local Player = Players:GetPlayerFromCharacter(Character)
	
	Player:LoadCharacter()
	
	ToolEquipped = false
	Character = nil
end)
1 Like

You can actually put a ServerScript inside a tool, and assuming the tool is first parented to the Backpack, it would be as easy as:

local player = script.Parent.Parent.Parent

local tool = script.Parent

tool.Unequipped:Connect(function()
	player:LoadCharacter()
end)

Hope this helps.

ok. thank you. i will try this and i let u know if worked