Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I Make this GUI Function in FilteringEnabled?

Asked by 5 years ago

I'm attempting to remake a room assignment GUI for a hotel I had made before the FE force switch. Essentially how this works is you type a players name into the GUI, hit enter, then the room number, then hit enter and the player will receive that key. I changed to using RemoteEvents in local scripts. So, there are four scripts: two for the room assignment, and two for the name assignment. Since the error is the same for both, I will post the name one. My issue comes in game when the "ControlGui" is not found in the Player's "PlayerGui" issue is on ServerScriptService.Name line 7.

Serverscript:

replStorage = game:GetService("ReplicatedStorage")
local remote = replStorage:WaitForChild("RemoteName")
name2 = ""
person = ""
remote.OnServerEvent:Connect(function(player)
    print(player)
    local tbox = player.PlayerGui.ControlGui.Background.AdminFrame.cabinBox
    print(player.PlayerGui.ControlGui.Background.AdminFrame.cabinBox)
    name2 = tbox.Text
    local length = string.len(name2)
    local players = {}
    for i,v in pairs(game.Players:GetChildren()) do
        table.insert(players,v.Name)
    end
    for i,v in pairs(players) do
        if string.sub(players[i] ,0,length) == name2 then
            person = players[i]
        end
    end
     game.Lighting.Name1.Value = person
end)

LocalScript:

replStorage = game:GetService("ReplicatedStorage")
local remote = replStorage:WaitForChild("RemoteName")
script.Parent.MouseButton1Click:connect(function()
    remote:FireServer()
end)

Any help would be greatly appreciated!

0
The server cannot access PlayerGui or its descendants unless the descendants were placed by the server. The server shouldn't be touching PlayerGui anyway. User#19524 175 — 5y
0
I found out recently that even if you try to access PlayerGui from the server your script can break lol. Garmadon455 0 — 5y

Answer this question