So I have made a script tutorial and I want to make sure that there’s nothing wrong about it, but I need someone to check it because this script is for premium players(Overhead UI and Chat Name), and I don’t have premium, So I think I asked the devforum, so any thing wrong here?
Code:
-- Services
local serverScriptService = game:GetService("ServerScriptService")
local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if player.MembershipType == Enum.MembershipType.Premium then
local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local clonedgui = billboardgui:Clone()
clonedgui.Parent = char:FindFirstChild("Head")
clonedgui.ImageLabel.Image = "rbxassetid://6377803675"
clonedgui.TextLabel.Text = "Premium"
clonedgui.TextLabel.TextColor = Color3.fromRGB(192,192,192)
local premium = clonedgui
chatService.SpeakerAdded:Connect(function(PlrName)
local speaker = chatService:GetSpeaker(PlrName)
for _, v in pairs(premium) do
if players[PlrName].Name == v then
speaker:SetExtraData('Tags',{{TagText = 'Premium', TagColor = Color3.fromRGB(255,255,255)}})
end
end
end)
end
end)
end)
If you want to test it yourself, just add a not right between the if and player.MembershipType. It will check to see if you don’t have premium. Simply revert it back when finished.
One thing I would say is that if possible, I’d move the chatservice connection outside the characteradded connection - while it’s inside, every time the character is loaded the connection is made again, which will take up more memory in the server and could cause lag eventually. Other than that, you can do what @xMagmaDev said to test, maybe instead of doing not premium say if premium or player.UserId == [yourid] to test it
I’ve experienced the chat issue as well. You have to go into game and the explorer and the proceed to copy the “Bubble chat” and another local script named “chat script”. Now leave the game and past the scripts, proceed to drag them into starter player scripts and try again.
In your script, add a print after ever line in your main execution and see where it stops.