No, I use different type of rank tags for example
this type this was a game I was working onThis is written assuming that the player already has a tag and is to detect when a player presses a key on their keyboard to turn the tag on/off server-side. If you want to add a tag to a player you’ll want to have a .PlayerAdded() function in the serverscript.
Such as this:
game:GetService("Players").PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local tag = Instance.new("BillboardGui", char.Head)
tag.ExtentsOffset = Vector3.new(0,4,0)
tag.Size = UDim2.new(0,200,0,50) --Change size and offset values as you please
local textLabel = Instance.new("TextLabel", tag)
textLabel.Text = "text" -- Set to whatever
textLabel.BackgroundTransparency = 1
textLabel.TextScaled = true
textLabel.Size = UDim2.new(1,0,1,0)
--Any other properties of the label or billboardgui you want to make go here
tag.Adornee = char.Head
end)
Script
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
Players.PlayerAdded:Connect(function(PlayerAdded)
PlayerAdded.CharacterAdded:Connect(function(CharacterAdded)
local Billboard = "path.to.billboard" -- example: game.ReplicatedStorage.Billboard:Clone()
Billboard.Enabled = true
Billboard.Adornee = CharacterAdded:WaitForChild("Head")
Billboard.Parent = CharacterAdded:WaitForChild("Head")
local Player = "path.to.billboard.player.name" -- example: Billboard.Player
Player.Text = PlayerAdded.Name
local Rank = "path.to.rank" -- example: Billboard.Rank
if PlayerAdded:IsInGroup("group.id") --[[ example: 194218]] then
Rank.Text = PlayerAdded:GetRankInGroup("group.id")
else
Rank.Text = ""
end
ReplicatedStorage.RemoteName --[[ example: BillboardDeactive/enable (ClassName.RemoteEvent)]].OnServerEvent:Connect(function()
Billboard.Enabled = not Billboard.Enabled
end)
end)
end)
LocalScript
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
UserInputService.InputBegan:Connect(function(InputBegan, GameProcessed)
if InputBegan.KeyCode == Enum.KeyCode.E --[[ example: A, B, C ]] then
ReplicatedStorage.RemoteName --[[ example: BillboardDeactive/enable (ClassName.RemoteEvent)]] :FireServer()
end
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.