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

Open Gui when a player joins the server is not working?

Asked by 4 years ago
Edited 4 years ago

Hiya! I want to make this choosing team GUI where it opens when the player joins.

Here is the code:

local RStorage = game.ReplicatedStorage
local Event = RStorage:FindFirstChild("GuiOpen")

local function OpenGui()
    script.Parent.Enabled = true
end


Event:FireServer(game.Players.PlayerAdded:Connect(OpenGui))

I have never used RemoteEvents before. So I dont know what I can do with them.

This is a LocalScript and it is parented under the ScreenGui

1 answer

Log in to vote
0
Answered by
Lunaify 66
4 years ago

Script in ServerScriptService

local replicatedStorage = game:GetService("ReplicatedStorage")
local enableGUIEvent = replicatedStorage:WaitForChild("EnableGUI")


game.Players.PlayerAdded:Connect(function(plr)
    wait(1)
    enableGUIEvent:FireClient(plr)
end)

LocalScript in ScreenGUI

local replicatedStorage = game:GetService("ReplicatedStorage")
local enableGUIEvent = replicatedStorage:WaitForChild("EnableGUI")

local screenGUI = script.Parent:WaitForChild("ScreenGui")

enableGUIEvent.OnClientEvent:Connect(function(player,plr)
    screenGUI.Enabled = true
end)

Notes make sure you set your ScreenGui's Enable property to false also make sure your order or whatever looks like this : https://media.discordapp.net/attachments/653682939024113689/672596993117519872/unknown.png

Ad

Answer this question