Bu örnek, bir grup üyeliğine dayanarak oyunculara sohbet etiketleri nasıl atanacağını gösterir.Sohbet etiketleri, sohbet penceresinde bir oyuncuyu görsel olarak tanımlamanın ve bir oyuncunun rolünü veya durumunu göstermenin bir yoludur.

Çünkü metin sohbet çağrıları bir oyuncunun grubun üyelik durumunu sorgulamaya çalışıyor ve grubun üyelik durumu askıya alınıyor veya yanıt vermiyor olabilir, çünkü sohbet sisteminin kilitlenmesine veya yanıt vermemesine neden olabilir.
Bunun yerine, sunucuya katıldıklarında bir oyuncuya özellik ayarlayın.Bir öznitelik ayarlamak, oyuncunun durumunu deneyimin diğer kısımlarında yeniden kullanmanıza izin verir, örneğin belirli alanlara erişim sağlamak veya bonus deneyim sağlamak.
Create a Script in ServerScriptService ve aşağıdaki kodu ekleyin:
Sunuculocal Players = game:GetService("Players")-- 123456'yi kontrol etmek istediğiniz grup kimliğiyle değiştirinlocal groupID = 123456Players.PlayerAdded:Connect(function(player)local success, isInGroup = pcall(function()return player:IsInGroup(groupID)end)if success and isInGroup thenplayer:SetAttribute("IsVIP", true)elseplayer:SetAttribute("IsVIP", false)endend)Create a LocalScript in StarterPlayer ⟩ StarterCharacterScripts ve sohbet penceresinde bir [VIP] etiketi görüntülemek için aşağıdaki kodu ekleyin:
Müşterilocal Players = game:GetService("Players")local TextChatService = game:GetService("TextChatService")TextChatService.OnIncomingMessage = function(message: TextChatMessage)local textSource = message.TextSourceif textSource thenlocal player = Players:GetPlayerByUserId(textSource.UserId)if player thenif player:GetAttribute("IsVIP") == true thenlocal overrideProperties = Instance.new("TextChatMessageProperties")overrideProperties.PrefixText = "[VIP] " .. message.PrefixTextreturn overridePropertiesendendendreturn nilend