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?
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?
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)
Is there a way to do it with remoteevents or functions?
I updated the script, if there's any errors let me know
Okay this seems like a bad idea. You're creating a remote event from the client and expecting the server to see it.
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.
1 comment
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.