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

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

Asked by
Asceylos 562 Moderation Voter
7 years ago

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?

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. iamnoamesa 674 — 7y

1 answer

Log in to vote
1
Answered by
oSyM8V3N 429 Moderation Voter
7 years ago
Edited 7 years ago

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)
0
Is there a way to do it with remoteevents or functions? Asceylos 562 — 7y
0
I updated the script, if there's any errors let me know oSyM8V3N 429 — 7y
0
Okay this seems like a bad idea. You're creating a remote event from the *client* and expecting the *server* to see it. iamnoamesa 674 — 7y
0
Your correct, i should of said to make the remote event be created through the server script oSyM8V3N 429 — 7y
Ad

Answer this question