Title explains everything, I can’t get my TextButtons to work…
LocalScript in StarterPlayerScripts:
local clientModules: Folder = game:GetService("ReplicatedStorage"):WaitForChild("ClientModules")
local areasModule: ModuleScript = clientModules:WaitForChild("Areas") :: ModuleScript
local connectSurfaceGuiModule: ModuleScript = areasModule:WaitForChild("ConnectSurfaceGui") :: ModuleScript
local areas = require(areasModule)
local connectSurfaceGui = require(connectSurfaceGuiModule)
local areaBarriers: Folder = workspace:WaitForChild("World"):WaitForChild("AreaBarriers")
for _, area in areas do
if not areaBarriers:FindFirstChild(area["name"]) then
areaBarriers:WaitForChild(area["name"])
for _, v in areaBarriers:FindFirstChild(area["name"]):GetDescendants() do
if v:IsA("SurfaceGui") then
connectSurfaceGui.connectSurfaceGui(v)
end
end
end
end
ModuleScript (connects every SurfaceGui):
local players: Players = game:GetService("Players")
local player: Player = players.LocalPlayer or players:GetPropertyChangedSignal("LocalPlayer"):Wait()
local playerGui: PlayerGui?
local connectSurfaceGui = {}
function connectSurfaceGui.connectSurfaceGui(surfaceGui: SurfaceGui)
playerGui = player:FindFirstChildOfClass("PlayerGui")
if not playerGui then return end
surfaceGui.Adornee = surfaceGui.Parent
surfaceGui.Parent = playerGui
end
return connectSurfaceGui
I’ve checked and every SurfaceGui has it’s Adornee property set to the BasePart it corresponds to. Every SurfaceGui is parented to the player’s PlayerGui.