Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Serverscript can't find GUI in FE or read the text of textboxes?

So I made a script

game.Players.Asceylos.PlayerGui:FindFirstChild("ScreenGui")

It errors and shows that it can't find screengui in PlayerGui. Is it normal on FE that serverscripts can't even read PlayerGuis?

1 comment

0

Instead of placing the gui in the StarterGuis, place it under server storage and clone it to their gui on spawn. That way, it is seen from the server. But if you want to have the server to see texts in boxes, you'd be better off using a remote event when the focus is lost on the TextBox.

1 answer

✓ Accepted answer

Yes, if your game is FE, the server can't read the player's playergui. Make a folder in the replicatedstorage and place all your gui's in there.

You can use something like this :

local p = game.Players.LocalPlayer
local Guis = game:GetService("ReplicatedStorage")
Guis."nameofguiyouwanthere":Clone().Parent = p.PlayerGui

Or you can place the script in the players starterplayerscripts in starterplayer and it will work. I use it in my games. Please comment if this helped, if any errors make sure to let me know.

If you want to use RemoteEvents, you can use something like this

|Client|

local Event = game.ReplicatedStorage.RemoteEvent
Event:FireServer()

|Server Script|

local Event = Instance.new("RemoteEvent")
Event.Parent = game.ReplicatedStorage
Event.OnServerEvent:connect(function(player)
Gui = game.ReplicatedStorage.guinamehere:Clone().Parent = player.PlayerGui

If you want the event to fire when the player joins the game then write this in the |Client|

game.Players.PlayerAdded:connect(function()
local Event = Instance.new("RemoteEvent")
Event.Parent = ReplicatedStorage
Event:FireServer()
end)

4 comments

0

Is there a way to do it with remoteevents or functions?

0

I updated the script, if there's any errors let me know

0

Okay this seems like a bad idea. You're creating a remote event from the client and expecting the server to see it.

0

Your correct, i should of said to make the remote event be created through the server script

This discussion is preserved as it was. New answers, comments, and votes are closed.