So this likes to appear the billboardgui over the baseplate and it won't go away. I don't get this. What am I doing wrong? The point is, hovering over a player should show their FirstName and Surname according to a DataStore that is always set if they're in-game and past the introduction where you pick your name. It literally just doesn't work at all properly and it's unexplainable. In starterplayerscripts:
local plr = game.Players.LocalPlayer local Mouse = plr:GetMouse() while wait(0.5) do if Mouse.Target ~= nil then if Mouse.Target.Parent:FindFirstChild("Humanoid") then plr.PlayerGui.BillboardGui.Enabled = true plr.PlayerGui.BillboardGui.Adornee = Mouse.Target.Head plr.PlayerGui.BillboardGui.FirstName.Text = game.ReplicatedStorage.getfirstname:InvokeServer(game.Players:GetPlayerFromCharacter(Mouse.Target.Parent)) plr.PlayerGui.BillboardGui.Surname.Text = game.ReplicatedStorage.getsurname:InvokeServer(game.Players:GetPlayerFromCharacter(Mouse.Target.Parent)) else plr.PlayerGui.BillboardGui.Enabled = false plr.PlayerGui.BillboardGui.Adornee = nil plr.PlayerGui.BillboardGui.FirstName.Text = "FirstName" plr.PlayerGui.BillboardGui.Surname.Text = "Surname" end end end
in serverscriptservice:
function game.ReplicatedStorage.getfirstname.OnServerInvoke(plr) return game:GetService("DataStoreService"):GetDataStore("FirstName_1"):GetAsync("user_"..plr.userId) end function game.ReplicatedStorage.getsurname.OnServerInvoke(plr) return game:GetService("DataStoreService"):GetDataStore("Surname_1"):GetAsync("user_"..plr.userId) end
Please help!
Unfortunately, I don't have 5 score yet, so i can't comment, but I think you have a few problems here: The functions cannot be triggered. To make a function trigger while declaring it you go:
game.ReplicatedStorage.getfirstname.OnServerInvoke:connect(function(plr) -- code end)
Also, getfirstname/surname sounds like a function, so it would most likely be :GetFirstName() or :GetSurname(). Also, Mouse may need to be activated before you can do something, but I haven't had any experience with mouse hover yet, so don't trust my suggestion. There may also be a few syntax probs in there, but it's too cluttered for me to find them.