I'm trying to update the server when I create these text labels above the player. I'm not getting errors, and it's printing, but the server isn't updating.
Here is my code:
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:wait() local BGUI = Instance.new("BillboardGui") local Name = Instance.new("TextLabel") local Rank = Instance.new("TextLabel") local Event = game:GetService("ReplicatedStorage").InfoAboveHead BGUI.Active = true BGUI.Adornee = game.Workspace:FindFirstChild(Player.Name).Head BGUI.AlwaysOnTop = false BGUI.Enabled = true BGUI.LightInfluence = 0 BGUI.MaxDistance = 30 BGUI.Name = "PlayerInfoAboveHead" BGUI.Parent = game.Workspace:FindFirstChild(Player.Name).Head BGUI.ResetOnSpawn = false BGUI.Size = UDim2.new(5, 0, 0.75, 0) BGUI.SizeOffset = Vector2.new(0, 3.5) BGUI.ZIndexBehavior = Enum.ZIndexBehavior.Sibling print("Overhead GUI created!") Name.Parent = BGUI Name.BackgroundTransparency = 1 Name.BorderSizePixel = 0 Name.Name = "NameText" Name.Size = UDim2.new(1, 0, 0.5, 0) Name.Font = Enum.Font.SourceSansSemibold Name.Text = Player.Name Name.TextScaled = true Name.TextColor3 = Color3.fromRGB(255, 255, 255) Name.TextWrapped = true print("Name text created") Rank.Parent = BGUI Rank.BackgroundTransparency = 1 Rank.BorderSizePixel = 0 Rank.Name = "RankText" Rank.Size = UDim2.new(1, 0, 0.5, 0) Rank.Font = Enum.Font.SourceSansLight Rank.Position = UDim2.new(0, 0, 0.5, 0) --Rank.Text = Player:GetRankInGroup() Rank.Text = "PlrRank" Rank.TextScaled = true Rank.TextColor3 = Color3.fromRGB(255, 255, 255) Rank.TextWrapped = true print("Rank text created!") Event:FireServer(BGUI, Name, Rank) print("Fired!")
Since you have already the 'Event:FireServer', might as well add a server script that will receive that event. The line 'Event:FireServer(BGUI, Name, Rank)' will pass the indicated parameters to the server script. Now, when the server script receives it, it will be the SERVER SCRIPT that will actually place all the info to the player. Now how do you let the server script do that, I can think of two ways:
A.) Create a template. Create a template of the billboard gui and store it within the Replicated Storage. Whenever the server script receives the parameter, the server script will clone the billboard gui, sets the info needed in the gui according to the parameters passed, then parent it on the PLAYER MODEL located within the Workspace. Now, if you want only the LOCAL PLAYER to see the gui, then parent it to the Player.Character (or something like this).
B.) You let the SERVER SCRIPT create the Instances. You should places the creation of the billboard gui and its descendants to the server script. The server script will then parent the billboard gui to your desired parent (as same to the first way above).The local script will just be the one responsible in getting the player's info and then passing it to the server script.