So when i try to show a gui like this . in a script in the ServerScriptService
1 | while true do |
2 | wait( 10 ) |
3 | for i,v in pairs (game.Players:GetPlayers()) do |
4 | v.PlayerGui.GUI.Block.Visible = true |
5 | end |
6 | end |
and after this . it show me this in the output !
17:21:51.288 - GUI is not a valid member of PlayerGui
and by the way the gui is in the playerGui !
You cannot access PlayerGui from ServerScriptService. Here is what you should do instead:
Create a "RemoteEvent" inside of ReplicatedStorage and name it "blockEvent"
You should have a server script with this code:
1 | while wait( 10 ) do --Every 10 seconds |
2 | game:GetService( 'ReplicatedStorage' ):WaitForChild( 'blockEvent' ):FireAllClients() --Fires everyone's client to set the visiblility to true. |
3 | end |
You should have a local script inside StarterGui with this code:
1 | game:GetService( 'ReplicatedStorage' ):WaitForChild( 'blockEvent' ).OnClientEvent:connect( function () -- When the client is fired from that player. |
2 | script.Parent.GUI.Block.Visible = true --Set the visibility to true. |
3 | end ) |
Hope this helps! If you need further help, just comment.