- Yes
- Yes, it’s inside the script
- No error
local Gui = script.Gui
script.Parent.Equipped:Connect(function()
Gui.Parent = game.Players.LocalPlayer.PlayerGui
end)
script.Parent.Unequipped:Connect(function()
Gui.Parent=script
end)
How about like this example?
Already tried something similar and it didn’t work.
I think local not inside function were way better. Is this client or server and is gui it’s ScreenGui?
The script is inside a tool inside the Player.Backpack. Yes it’s a screengui
Is that LocalScript? Not Serverside Script right?
local Gui
script.Parent.Equipped:Connect(function()
if not Gui then
Gui = script.Gui:Clone()
end
Gui.Parent = game.Players.LocalPlayer.PlayerGui
end)
script.Parent.Unequipped:Connect(function()
if Gui then
Gui:Destroy()
end
end)
How about turn off RequiresHandle at Tool? but if Equipped cant be fired
see if the gui is enabled or its children is visible
Try this I added some debugging code lines
-- This script should be a LocalScript
local tool = script.Parent
tool.Equipped:Connect(function()
print("Tool equipped")
local Gui = script:FindFirstChild("Gui")
if Gui then
local clonedGui = Gui:Clone()
clonedGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
print("Gui cloned and parented to PlayerGui")
else
warn("Gui not found in the script")
end
end)
tool.Unequipped:Connect(function()
print("Tool unequipped")
local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local mapGui = playerGui:FindFirstChild("Map")
if mapGui then
mapGui:Destroy()
print("Map GUI destroyed")
else
warn("Map GUI not found in PlayerGui")
end
end)
Nothing printed, the map is visible and it’s parent screengui is enabled, so idk what’s going on.
can you show picture tool with stuff? i see you say print doesnt show anything?
there only reason Tool equipped cant be trigger should be
First Make sure RequiresHandle it’s Disabled it in tool properties or you have add Part with name “Handle” in tool
Disabling RequiresHandle worked, thanks!
I just have another issue with another tool, where it won’t clone into the player’s backpack from serverstorage. I have other tools that do the same and they work but for some reason one of them doesn’t do anything at all and won’t clone unless I manually drag it from serverstorage into the player through the explorer.
example i can say
game.ServerStorage['Tool Name']:Clone().Parent=player.Backpack
can ik where your script gonna put?
It’s in serverscriptservice and is run by an event.
BindableEvent?
workspace['Event'].Event:Connect(function(player,item)
game.ServerStorage[item]:Clone().Parent=player.Backpack
end)
workspace.Part.Touched:Connect(function(hit) -- there was no debounce soo it willl be multiple problem
if hit.Parent and game.Players:FindFirstChild(hit.Parent.Name)then
workspace.Event:Fire(
'Name Tool', -- item
game.Players[hit.Parent.Name] -- player
)
end
end)
RemoveEvent (chars chars chasrs)
And I already got it to work, thanks.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.