Log in to vote

RemoteEvent isn't working (not updating server), what am I doing wrong?

Asked by 2 years ago

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 ="BillboardGui")
local Name ="TextLabel")
local Rank ="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 =, 0, 0.75, 0)
BGUI.SizeOffset =, 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 =, 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 =, 0, 0.5, 0)
Rank.Font = Enum.Font.SourceSansLight
Rank.Position =, 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)
Can you also show where you do OnServerEvent? DarkDanny04 407 — 2y
I haven't done that, I'm new to remote events. Do I need to? matiss112233 258 — 2y
you cant just put :FireServer() if you don't have a server script that will handle it. Dexiber 272 — 2y
so what do i put in the OnServerEvent function? Do I recreate the roles? I'm confused. matiss112233 258 — 2y

1 answer

Log in to vote
Answered by
Padugz 40
2 years ago

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.

I think im going to go with a, thats what I was going to do originally, I just got caught up with the remote events and changed a ton of s**t matiss112233 258 — 2y

Answer this question