Gui show on server

it is still not showing the notification gui tho :confused:

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("ReceivedCoinsSound")
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()
		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()
end)

Did things like print(“Making Notifier Disappear”) appear in the console? Assuming that the first time around, it didn’t get past the if statement, do you know where the script ends now?

yes, everything printed in the console
image

Your tweening might be the problem then. Try something simpler to make sure it works, for example add an already visible textbox that changes text to “Owner Joined” when the owner joins. That should work. I’d suggest rewriting the tweens if you can’t find what you did wrong in them

you mean check if the textlabel is visible?

I have fixed your code. (Hopefully)

Sever:

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 = Coins.Value +BonusValue
		Check:FireAllClients()
		print("Coins Successfully Given to Players!")

		PlayCoinsSound:Play()
	else
		print("Owner hasn't join the game yet!")
	end
end)

Local:

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()

Check.OnClientEvent:Connect(function()
	ReceivedCoinsSound:Play()
	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()
end)

On the server script, it still gives coins only to the owner. It should instead loop through all players and give them the bonus. Not sure how to quote stuff in blocks of code though lol

What’s the difference? I can’t tell it tho is still causing the same problem

Whoops try replacing this then

if player.UserId == OwnerUserId then
		print("Owner has joined the game!")
		Check:FireAllClients()
		print("Coins Successfully Given to Players!")
		if player.UserId ~= OwnerUserId then
			Coins.Value = Coins.Value +BonusValue
		end

		PlayCoinsSound:Play()
	else
		print("Owner hasn't join the game yet!")
	end

Hi,
I’d like to reccomend you make a StarterGui that has a text label with a script inside of it.
Use a function in replicated storage and a script in server script service that listens for when you join, then it fires a function that the starter gui listens for then it makes the text label visible etc.

now it gives the coins to no one.

Replace it with something like:
for i, v in pairs(game.Players:GetPlayers()) do
v.leaderstats.Coins.Value += BonusValue
end

this should work 100% (Although I havent tested it)

if player.UserId == OwnerUserId then
		print("Owner has joined the game!")
		Check:FireAllClients()
		print("Coins Successfully Given to Players!")
		for i,v in pairs(game.Players:GetChildren()) do
			if v.UserId ~= OwnerUserId then
				Coins.Value = Coins.Value +BonusValue
			end
		end

		PlayCoinsSound:Play()
	else
		print("Owner hasn't join the game yet!")
	end

If the owner is ingame, get all players in server and check if their userid isnt the owners one. Then add (BonusValue) to their current coins value.

Still one problem. Coins.Value would just give coins to the owner based on how many players are in the game. Hence why I did v.leaderstats.Coins.Value and not the previously defined Coins

Sorry for making so many mistakes, its hard for me to make code without testing it. Anyway, heres another attempt:

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    
	
	local function GiveCoins()
		for i,v in pairs(game.Players:GetChildren()) do
			Coins.Value = Coins.Value +BonusValue
		end
	end
	
	if player.UserId == OwnerUserId then
		print("Owner has joined the game!")
		Check:FireAllClients()
		print("Coins Successfully Given to Players!")
		GiveCoins()

		PlayCoinsSound:Play()
	else
		print("Owner hasn't join the game yet!")
	end
end)

Now, it doesn’t update the coins value

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!")
		for _,v in pairs(game.Players:GetPlayers()) do
			v.leaderstats.Coins.Value += BonusValue
			Check:FireAllClients()
		end
	else
		print("Owner hasn't join the game yet!")
	end
end)

nvm, it works the game wasn’t publish properly and the server give coins to everyone but the problem is now the gui doesn’t show to everyone

put Check:FireAllClients outside of the for loop, but as for the guis not showing, I think you did something wrong with the tweens. Try doing something simpler for now instead of tweening (for example just make a gui’s transparency go to 0 to make sure it works), and then after you know that it works, add tweens back

No, it wasn’t because of my tween I did some changes in the script and it fully function now. Tysm :smiley:

1 Like