Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

screen gui doesnt change billboard text. WHY???

local BillboardGui = game:GetService('ReplicatedStorage'):WaitForChild('BillboardGui')
local text = script.Parent.Parent.TextBox.Text
script.Parent.MouseButton1Click:connect(function()
    BillboardGui.frame.TextBox.Text = text
    print ("text changed")
end)
local BillboardGui = game:GetService('ReplicatedStorage'):WaitForChild('BillboardGui') --You may have also made a spelling mistake here.

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char) --Fires everytime the player respawns
        char:WaitForChild('Head')
        local clonedBillBoard = BillboardGui:Clone()
        clonedBillBoard.Parent = char.Head
        clonedBillBoard.frame.RPText.Text = plr.Name
    end)
end)

the first script is in a textutton and the second is in server script service

1 answer

You're changing the UI stored in ReplicatedStorage, rather than the one in the client's PlayerGui.

Parent the Billboard to the client's PlayerGui, and set its Adornee property to the client's Head.

TextButton LocalScript:

local plr = game.Players.LocalPlayer --The client
local plrUI = plr:WaitForChild("PlayerGui") --The client's UI
local BillboardGui = plr:WaitForChild("BillboardGui") --Billboard

script.Parent.MouseButton1Click:connect(function()
	--Define inside the event so 'text' variable updates
	local text = script.Parent.Parent.TextBox.Text
	BillboardGui.frame.TextBox.Text = text
	print("text changed")
end)

Script in ServerScriptService:

--No need for WaitForChild since it is in ReplicatedStorage
local BillboardGui = game.ReplicatedStorage.BillboardGui

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		char:WaitForChild("Head")
		local clonedBillBoard = BillboardGui:Clone()
		--Parent(where its located)
		clonedBillBoard.Parent = plr.PlayerGui
		--Adornee(where it shows up)
		clonedBillBoard.Adornee = char.Head
		clonedBillBoard.frame.RPText.Text = plr.Name
	end)
end)

1 comment

0

i get this error 19:39:08.069 - Infinite yield possible on 'Players.EpicAshtonTheBoy:WaitForChild("BillboardGui")'

This discussion is preserved as it was. New answers, comments, and votes are closed.