How to make tools not appear in the player inventory until they press a button

ive made a welcome gui with a button that makes all the other guis and tools appear, however only the tools do not appear after the button is pressed, how can i change the script so they’ll show up after the button is pressed?

Explorer tab
Screenshot_38

the script im using:

local Sui = script.Parent.Parent.Parent
local close = script.Parent

local buttons = script.Parent.Parent.Parent.Parent.Buttons
local sp = game:GetService("StarterPack") 
local toolContainer = sp.toolContainer

close.MouseButton1Click:connect(function()
	Sui:Destroy()
	wait(1)
	for _, tool in ipairs(toolContainer:GetChildren()) do
		tool.Parent = nil
	end

	for _, tool in ipairs(toolContainer:GetChildren()) do
		tool.Parent = sp
	end
	buttons.Enabled = true
end)
1 Like

I think it is because you’re putting the tools in the starterpack and not the backpack?
OR maybe it could be that you’re deleting Sui so the code gets destroyed ?

Try this:

local Sui = script.Parent.Parent.Parent
local close = script.Parent

local buttons = script.Parent.Parent.Parent.Parent.Buttons
local backpack = game.Players.LocalPlayer:WaitForChild("Backpack")
local toolContainer = game.ReplicatedStorage.toolContainer -- put the toolContainer thing in game.ReplicatedStorage

close.MouseButton1Click:connect(function()
	--Sui:Destroy() for now without this
	wait(1)
	for _, tool in ipairs(toolContainer:GetChildren()) do
		tool.Parent = backpack
	end
	buttons.Enabled = true
end)

Let me know if it worked, and if not what error did you get and what is happening.

Parent the tool to player.Backpack so they can have the tool. The StarterPack is just the service that gives you the tools when you join the game.

that worked, thank you! i suck at scriping XD

1 Like

No problem , that is my first marked solution on the devforums so I am a beginner too :sweat_smile::+1:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.