I don't know why it isn't working
01 | local Player = game:GetService( "Players" ).LocalPlayer |
02 |
03 | local Tool = game.StarterPack.HighPad |
04 |
05 | Tool.Equipped:Connect( function () |
06 | Player.PlayerGui.Tablet.OuterBody.Visible = true |
07 | Player.PlayerGui.Tablet.OuterBody.Active = true |
08 | end ) |
09 |
10 | Tool.Unequipped:Connect( function () |
11 | Player.PlayerGui.Tablet.OuterBody.Visible = false |
12 | Player.PlayerGui.Tablet.OuterBody.Active = false |
13 | end ) |
Put your gui in the tool. Then put this script in the tool:
1 | script.Parent.Equipped:Connect( function () |
2 | player = game.Players:FindFirstChild(script.Parent.Parent.Name) |
3 | gui = script.Parent:FindFirstChild( "GuiName" ):Clone().Parent = game.Players:FindFirstChild(script.Parent.Parent.Name) |
4 | end ) |
5 |
6 | script.Parent.Unequipped:Connect( function () |
7 | game.Players [ player ] .PlayerGui.GuiName:Destroy() |
8 | end ) |
This should fix your problem. If it doesn't, the output from this script in ROBLOX Studio should say something that is easy enough to understand and help you fix the issue.
You are connecting the function to the Equipped signal of the tool in StarterPack. When the player spawns, the tool will be cloned into the player's backpack but the script will continue to listen for when the tool which is in StarterPack is equipped. To fix this, you could put the script under the tool and replace this line
1 | local Tool = game.StarterPack.HighPad |
with this
1 | local Tool = script.Parent |