Okay so basically, i have a nametag which shows a player name and level. I have this to update every couple' seconds and works perfectly. However, i wanted to enable filtering, so i wanted to work around the local script problem. It works, however you cannot see the other player's nametag, only your own tag which is weird.
Here is the server side script:
game.Players.PlayerAdded:connect(function(player)
player:WaitForChild("Backpack")
local event = Instance.new("RemoteEvent")
event.Parent = player.PlayerGui
event.Name = "LvlHeadEvent"
local function Fire()
event:FireClient(player)
print("event sent")
end
while wait(1.5) do
Fire()
end
end)
Here is the Nametage Billboard GUI (client side, local script)
local player = script.Parent.Parent
function onPlayerUpdate()
wait(0.1)
if (player.Character:FindFirstChild('FakeHead')~=nil) then
if (player.Character.Head:FindFirstChild("BillboardGui")==nil) then
local gui=Instance.new("BillboardGui")
gui.Parent=player.Character.Head
gui.Adornee=player.Character.Head
gui.Size=UDim2.new(20,0,1,0)
gui.StudsOffset=Vector3.new(0,2,0)
local text1=Instance.new("TextLabel")
text1.Text = ("Loading")
text1.FontSize = "Size8"
text1.TextColor3 = Color3.new(255,255, 255)
text1.TextStrokeColor3 = Color3.new(0, 0, 0)
text1.TextScaled = true
text1.TextStrokeTransparency = 0
text1.Size=UDim2.new(1,0,1,0)
text1.Position=UDim2.new(0,0,-0.5,0)
text1.BackgroundTransparency = 1
text1.Parent=gui
else
player.Character.Head.BillboardGui.TextLabel.Text= (player.Name..", Level: "..player.leaderstats.Lvl.Value)
end
end
end
local event = script.Parent:WaitForChild("LvlHeadEvent")
event.OnClientEvent:connect(function()
onPlayerUpdate()
end)
thanks for any help if youre good with this stuff haha, ~bubs

1 comment
Edited my answer. As far as I could tell there's no need for RemoteEvents.