Trying to show textlabel to all players

Hey, I am trying to make a gui appear with the players name. Right now it works fine for the client, they can see their name but the problem is all the other clients see nothing. I have tried using a server script, local script and events. Please help, it would be VERY appreciated!

// local script inside billboardgui text label
local rainbow = {
	Color3.fromRGB(254, 0, 0);
	Color3.fromRGB(255, 127, 0);
	Color3.fromRGB(225, 221, 1);
	Color3.fromRGB(0, 200, 0);
	Color3.fromRGB(0, 160, 199);
	Color3.fromRGB(0, 55, 230);
	Color3.fromRGB(129, 16, 210);
}

local info = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
script.Parent.TextColor3 = rainbow[1]

local name = game.Players.LocalPlayer.Name
script.Parent.Text = name

local i = 1
	
while true do
	local tween = game:GetService("TweenService"):Create(script.Parent, info, {TextColor3 = rainbow[i]})
	tween:Play()
	repeat wait() until tween.Completed
	wait(0.1)
	if i == #rainbow then i = 1 else i = i + 1
	end	
end
2 Likes

Correct me if I am wrong, but you shouldn’t add a semicolon for the last line of the table, because it’s the last line there, you don’t need to separate it from any upcoming lines.

1 Like

its not the rainbow text that doesnt work, its the player seeing their own name and the whole server seeing their name, the rainbow text works perfectly

1 Like

Both comma and semicolon are valid syntaxes to separate elements of a table in Lua, that’s not the problem here.

it works fine for the client, they can see their name but the problem is all the other clients see nothing

What do you mean by this? Only one player sees it?

yeah, only the client sees the name. others see the pre set text [name]

Every single player has their own local script??

um what? theres only one localscript for this

local marketPlaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local rainbowTitleId = 14284899
local balloonId = 14284908
local segwayId = 14284911
local vipId = 14284920

function UserOwnsGamePassAsync(PlayerID,GamePass)
	local Success,Results = pcall(function()
		return marketPlaceService:UserOwnsGamePassAsync(PlayerID,GamePass)
	end)
	print(Success,Results)
	if Success and Results then
		return true
	end
end

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if UserOwnsGamePassAsync(player.UserId,rainbowTitleId) then
			ReplicatedStorage:WaitForChild("OverheadGui"):Clone().Parent = character:WaitForChild("Head")
			ReplicatedStorage:WaitForChild("OverheadGui").TextLabel.Text = player.Name -- i tried this now
		end
		if UserOwnsGamePassAsync(player.UserId, balloonId) then
			ReplicatedStorage:WaitForChild("GreenBalloon"):Clone().Parent = player:WaitForChild("Backpack")
			ReplicatedStorage:WaitForChild("GreenBalloon"):Clone().Parent = player:WaitForChild("StarterGear")
		end
		if UserOwnsGamePassAsync(player.UserId, segwayId) then
			ReplicatedStorage:WaitForChild("Segway"):Clone().Parent = player:WaitForChild("Backpack")
			ReplicatedStorage:WaitForChild("Segway"):Clone().Parent = player:WaitForChild("StarterGear")
		end
	end)
end)

find the comment lol and youll see what i tried and if it is close

The problem is that changing the name on a local script won’t do anything for other players. I would probably just put this in a server script, and have a “String Value” that is a child of the billboard gui. When you clone the billboard gui, change the String Value’s value to the player’s name. Then you can get the player’s name from that string value. Same code except change this line:

local name = game.Players.LocalPlayer.Name

to:

local name = script.Parent:FindFirstChildWhichIsA("String Value").Value

didint work, it only shows the client the name

You put it in a normal script?

local script, i thought thats what you said

my whole script with your addition would work?

in a server script it doesnt even show the text labels text

So when you clone the billboard gui on the server side, insert a string value into it, and the string value should be the player’s name. Put the code into a normal script, then delete this line:

local name = game.Players.LocalPlayer.Name

and replace it with:

local name = script.Parent:FindFirstChildWhichIsA("String Value").Value

what? i put the whole script in server?

Just replace the local script with a normal script, still have the normal script as a child of the billboard gui.

you could just use a for loop…