Gui show on server

How do I make a Gui show on server?

1 Like

Can you give us more information? Since your topic is lacking of informations

Okay, so I’m making a Owner join notification and I want it to show on the server. How do I access the PlayerGui?

Playergui are located in a player instance (which is a player). To do it, use a game.Player:GetPlayers() to get all players into a table. Then you can just for loop a table and get a player’s playergui.

If you didnt understand. I’ll explain

can I just do this or do I have to loop through a table?

local player = game.Players:GetPlayers()
local PlayerGui = player:WaitForChild("PlayerGui")
local Notifier = PlayerGui.TextLabel
local Frame = PlayerGui.Frame

Since a player variable is a table. And you are currently trying to set all players. Use for loops

for i,v in pairs(game.Players:GetPlayers()) do
--code here
end

this is the code.

the variable v is each player in a server

why do I have error?
image

	for _,v in pairs(game.Players:GetPlayers()) do
			v.PlayerGui.TextLabel
		end

It’s because you didnt type the code correctly yet

When ever the owner joins you can have a server script that fires a remote event to all the clients telling them to show the owner joined prompt

game.ReplicatedStorage.Remotes.OwnerJoined:FireAllClients()

I think that is what I did but not everyone get notified

1 Like

Are there any errors in the output?

The code is incorrect since you didnt defind any textlabels yet

Nope, no error I tried it with my alt and as you can see in the video the owner joins the game but I’m not getting notified and not getting the bonus coins

Could you please show us the server and client sided code that handles this?

1 Like

Did you set the text properties yet?

Okay, sure here you go

-- ServerScript

local tween = game:GetService("TweenService")
local Check = game.ReplicatedStorage.Events:WaitForChild("Check")
local PlayCoinsSound = game.ReplicatedStorage.Events:WaitForChild("PlayCoinsSound")
local BonusValue = 10000
local OwnerUserId = 1533601134

game.Players.PlayerAdded:Connect(function(player)
	local Folder = Instance.new("Folder")
	Folder.Name = "leaderstats"
	Folder.Parent = player
	local Coins = Instance.new("IntValue")
	Coins.Name = "Coins"
	Coins.Parent = Folder    
	
	if player.UserId == OwnerUserId then
		print("Owner has joined the game!")
		Coins.Value = BonusValue
		PlayCoinsSound:FireAllClients()
		print("Coins Successfully Given to Players!")
		
		Check:FireAllClients()
	else
		print("Owner hasn't join the game yet!")
	end
end)
-- LocalScript

local player = game.Players.LocalPlayer
local tween = game:GetService("TweenService")
local Check = game.ReplicatedStorage.Events:WaitForChild("Check")
local PlayCoinsSound = game.ReplicatedStorage.Events:WaitForChild("PlayCoinsSound")
local ReceivedCoinsSound = game.ReplicatedStorage.SoundModule:WaitForChild("ReceivedCoins")
local Frame = script.Parent:WaitForChild("Frame")
local Notifier = script.Parent.Frame:WaitForChild("TextLabel")
local OwnerUserId = 1533601134
local RunTime = 10

local C = Frame.UIGradient.Rotation
local X = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, -1 ,false, 0.1)
local G = {Rotation = C + 360}
local P = tween:Create(Frame.UIGradient, X, G)
P:Play()

PlayCoinsSound.OnClientEvent:Connect(function()
	ReceivedCoinsSound:Play()
end)

Check.OnClientEvent:Connect(function()
	print("Double Checking Authentication")
	if player.UserId == OwnerUserId then
		print("Successful! " .. OwnerUserId)
		Notifier.Text = "🎉Congratulations you met a creator and you received a bonus of 10,000 Coins!🎉"
		print("Showing Notification")
		local H = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
		local W = {BackgroundTransparency = 0, TextTransparency = 0}
		local M = tween:Create(Notifier, H, W)
		M:Play()
		local T = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.In, 0, false, 0)
		local E = {BackgroundTransparency = 0}
		local S = tween:Create(Frame, T, E)
		S:Play()
		task.wait(RunTime)
		print("Making Notifier Disappear")
		local A = TweenInfo.new(.8, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
		local O = {BackgroundTransparency = 1, TextTransparency = 1}
		local B = tween:Create(Notifier, A, O)
		B:Play()
		local F = TweenInfo.new(.8, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
		local L = {BackgroundTransparency = 1}
		local J = tween:Create(Frame, F, L)
		J:Play()
	else
		print("Failed to find " .. OwnerUserId)
	end
end)

I think it’s not supporting a emoji. Could you delete a emoji and re-try please?

ignore that xd I was trying to type something but this chat filter

I did what you said, I deleted the emoji and re-try again is still causing the same problem

In the localscript, the “Check” event should not check if the player is the owner again. In the server script, you already only made it fire to all clients when the owner joins, so theoretically only the owner would get this notification. Remove the “if player.UserId == OwnerUserId” in the localscript. Also, make sure you give the coins in the server script so everyone can see it

1 Like