Make the text inside a Billboard Gui different for each player

So I want to make the text inside a TextLabel in a BillboardGui different for each player. I have tried making a LocalScript inside the TextLabel that automatically changes the text, but the script didn’t fire. By the way the BillboardGui is in a part inside the Workspace.

Could you please show the script?

Here it is:

function start()
	while true do
		local price = 10000 * (game.Players.LocalPlayer.leaderstats.Rebirths.Value + 1)
		script.Parent.Text = "$" .. abbreviate(price)
		print(abbreviate(price))
		wait(1)
	end
end

game.Loaded:Connect(start)

I tried using the loop by itself, making it a function and firing it by itself and firing it when the game loads. Nothing seems to work.

I also tried printing the price to see if it fired, but it didn’t output anything.

Edit: Hearbeat doesn’t seem to work either:

game["Run Service"].Heartbeat:Connect(function()
	local price = 10000 * (game.Players.LocalPlayer.leaderstats.Rebirths.Value + 1)
	script.Parent.Text = "$" .. abbreviate(price)
	print(abbreviate(price))
	wait(1)
end)

Is abbreviate a function?

Yes, it just turns a number from 1000 to 1K for example. I’ve used it tho inside other LocalScripts and it worked perfectly.

Does the heartbeat function run? Trying printing in it. Also make sure that it’s a local script.

No, it doesn’t, everything in the output console is just some random debug print.

I see the issue, Local Scripts don’t run inside workspace. Try adding StarterCharacterScripts and making a variable connecting to the Billboardgui textlabel.

The thing is that it has to be different for everyone…

1 Like

I know Local Scripts don’t change for everybody only the client.

Won’t connecting a variable from StarterCharacterScripts show the same value to the whole server? It’s supposed to show the price of a rebirth to everyone separately, and the prices change depending on the rebirth you’re at.

No. Server-Scripts replicate to everyone, While local scripts only replicates to the client. It creates a copy for each player. Local Scripts will always replicate to the client. Local Scripts can’t be added in some places such as ServerScriptService, ServerStorage, Workspace.

Could you show me an example on connecting the variable to the BillboardGui? I never tried doing that before since I never ran into this.

Sure! It’s just like any other variable.

local BillBoardGui = game.Workspace.Part.BillBoardGui
local TextLabel = BillBoardGui.TextLabel

image

1 Like

Oh yeah! And if I change the text from the LocalScript inside StarterCharacterScripts will it run individually?

Yup!

Im trying it rn, letting you know if it works.

Edit: It works!! Tysm! I marked it as the solution.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.