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

Read The Desc To See The Question It Doesn't Fit Up Here XD Question Mark To Publish: ?

I Can't Find A Way To Make So When You Press A Gui Button A Tool Gets Equipped And The Tool Can't Be Unequipped And The Tool's Backpack Icon Goes Invisible?

1 answer

✓ Accepted answer

You can store the tool somewhere like Replicated Storage, and then once the button is pressed you send it in to the player's character. And to hide a player's backpack, you would use StarterGui:SetCoreGuiEnabled to make it disappear. For example;

local StarterGui = game:GetService("StarterGui") -- gets the startergui
local ReplicatedStorage = game:GetService("ReplicatedStorage") -- gets storage
local button = -- your GUI button
local tool = ReplicatedStorage:WaitForChild("Tool") -- your tool
local character = -- how do you want to get the player's character?

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false) -- the core gui Backpack, and we set it to false meaning it is not visible

button.MouseButton1Click:Connect(function()
	local newTool = tool:Clone() -- clone the tool because we don't want to run out
	newTool.Parent = character -- since the backpack is disabled, a player cannot unequip it
end)

Here is a link for StarterGui:SetCoreGuiEnabled():

https://developer.roblox.com/en-us/api-reference/function/StarterGui/SetCoreGuiEnabled

Hope this helps and if not I hope it leads you in the right direction :D

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