lplayer = game:GetService("Players").LocalPlayer
local ReachGui = Instance.new("ScreenGui")
local Button = Instance.new("TextButton")
ReachGui.Name = "ReachGUI"
ReachGui.Parent = game:GetService("CoreGui")
Button.Name = "ReachButton"
Button.Parent = ReachGui
Button.BackgroundColor3 = Color3.new(0.235294, 0.235294, 0.235294)
Button.BorderColor3 = Color3.new(0, 0, 0)
Button.Position = UDim2.new(0, 10, 0.5, 0)
Button.Size = UDim2.new(0, 100, 0, 28)
Button.Font = Enum.Font.Cartoon
Button.FontSize = Enum.FontSize.Size22
Button.Text = "Reach"
Button.TextColor3 = Color3.new(1, 1, 1)
Button.TextScaled = false
Button.TextStrokeTransparency = 1
Button.TextWrapped = false
Button.MouseButton1Click:connect(function()
for i,v in pairs(game:GetService'Players'.LocalPlayer.Character:GetChildren())do
if v:isA("Tool") then
local a = Instance.new("SelectionBox",v.Handle)
a.Adornee = v.Handle
v.Handle.Size = Vector3.new(0.5,0.5,10)
v.GripPos = Vector3.new(0,0,0)
lplayer.Character.Humanoid:UnequipTools()
end
end
game:GetService("StarterGui"):SetCore("SendNotification", {
Title = "Reach applied!";
Text = "Applied to equipped sword or clean. By Apex :)";
})
end)
UI keeps leaving PlayerGui after they reset?
1 answer
Issue
Error when using coregui as the parent?
Solution
You can't set CoreGui as the parent of a GUI. You can't because it is reserved for UI pertaining to CoreScripts such as the ROBLOX UI.
Unless you're intent is to use this for exploiting, or this is meant for a Studio Plugin, you will not be able to use CoreGui as a parent at all.
You will have to set the Parent of your UI to the lplayer's PlayerGui folder.
https://developer.roblox.com/en-us/api-reference/class/PlayerGui
ReachGui.Parent = lplayer:WaitForChild("PlayerGui")
If you would also like to keep the player's UI even after they have reset then you would want to toggle the ResetOnSpawn property to false.
https://developer.roblox.com/en-us/api-reference/property/LayerCollector/ResetOnSpawn
ReachGui.ResetOnSpawn = false
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
I'm so stupid, I thought coregui is where the UI never leaves the localplayer's GUI.
Basically, I'm trying to keep the UI in player's GUI even when they reset.
I'll edit my answer real quick.
Thank you!