Tool gui not working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a tool that when equipped shows a gui.

  2. What is the issue? Include screenshots / videos if possible!
    I have tried many workarounds but none have worked so far.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried looking at a video and looking at posts about people who had the same issue, but none of their solutions worked and I did look on the dev hub.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
The code is in a server script inside of a tool.

local playname = script.Parent.Parent.Parent.Name
local tool = script.Parent
local player = game:GetService("Players"):WaitForChild(playname)

local gui = player.PlayerGui
local newgui = script.Janitorgui:Clone()
newgui.Parent = gui

tool.Equipped:Connect(function()
	newgui.Enabled = true
end)

tool.Unequipped:Connect(function()
	newgui.Enabled = false
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

GUI’s can only be handled through the client, it’s not working because you are using a server script.

make a LocalScript in the tool and put the gui inside it and paste:

local player = game.Players.LocalPlayer

local tool = script.Parent

local gui = player.PlayerGui
local newgui = script.Janitorgui:Clone()
newgui.Parent = gui

tool.Equipped:Connect(function()
	newgui.Enabled = true
end)

tool.Unequipped:Connect(function()
	newgui.Enabled = false
end)
1 Like