G’day! As the title says, I want my tool to always be equipped when it cloned into the player’s backpack.
In more detail, when the player selects the sword from a GUI, it will be cloned into the player’s backpack and have the sword instantly equipped, therefore playing its idle animations. I don’t want the player to be able to unequip the sword unless they chose a different one from the game’s GUI menu.
I can’t think of a method on how to completely prevent the tool from being unequipped, but what you could do is when the player unequips the tool, you immediately equip it again. And then when a player clicks the ui to select another sword, you can remove the sword that’s the player had chosen before, and clone the new one into the player’s backpack.
Am I doing it wrong? I disabled the Backpack CoreGUI with this local script located in Replicated First: game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
And this is a script thats fired via RemoteEvent when the GUI button for the sword has been clicked:
local ServerStorage = game:GetService("ServerStorage")
local Greatsword = ServerStorage.Greatsword
ReplicatedStorage.PickWeapon.OnServerEvent:Connect(function(player)
local GreatswordCopy = Greatsword:Clone()
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:EquipTool(GreatswordCopy)
end
end)
The sword is not equipped nor to be found anywhere in the player’s model.