I am trying to make a :rank command. That changes the players rank UI with a certain command, I know how to do it with the Basic admin :s command and the Developer console But I don’t want to type all that code out as It takes a while.
This is the DeV Console Code I use and Have been trying to use For the basic admin plugin script is.
Here’s some updated code; looks like something isn’t working on line 16:
local prefix = ":"
local Players = game:GetService("Players")
local TextService = game:GetService("TextService")
local adminId = 1197680948
local function onPlayerAdded(player)
local character = player.Character or player.CharacterAdded:Wait()
player.Chatted:Connect(function(msg)
local split = msg:split(" ")
if player.UserId == adminId and split[1]:lower() == prefix.."rank" then
local playerName = split[2]
local rank = split[3]
if playerName and rank then
local playerInstance = Players:FindFirstChild(playerName)
if playerInstance then
local playerCharacter = playerInstance.Character or playerInstance.CharacterAdded:Wait()
playerCharacter:WaitForChild("Head"):WaitForChild("Rank"):WaitForChild("Frame"):WaitForChild("TextLabel").Text = TextService:FilterStringAsync(rank, player.UserId):GetNonChatStringForBroadcastAsync() --doesnt seem to be working
end
end
end
end)
end
Players.PlayerAdded:Connect(onPlayerAdded)
for k, v in ipairs(Players:GetPlayers()) do
onPlayerAdded(v)
end