Roblox Scripting Tutorial: Custom Role Playing Nicknames and Text Filtering
This tutorial is a must watch! We're learning not only how to make a BillboardGui roleplay nickname system, but we're also learning how to filter text and working with more FilteringEnabled! Post any questions you have down in the comments.
Scripts as they appear in the video (don't forget about the Remote Event and Function):
Button LocalScript:
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage.ChangeName
local filter = replicatedStorage.FilterText
local player = game:GetService("Players").LocalPlayer
local box = script.Parent.Parent.TextBox
script.Parent.MouseButton1Down:connect(function()
local filteredText = filter:InvokeServer(box.Text)
box.Text = filteredText
event:FireServer(filteredText)
end)
BillboardGui Server Script:
game.Players.ChildAdded:connect(function(player)
local name = Instance.new("StringValue")
name.Name = "RPName"
name.Value = player.Name
name.Parent = player
player.CharacterAdded:connect(function(char)
char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local bill = Instance.new("BillboardGui", char.Head)
bill.Adornee = char.Head
bill.Size = UDim2.new(1,0,1,0,0,0)
bill.StudsOffset = Vector3.new(0,2,0)
local text = Instance.new("TextLabel")
text.Parent = bill
text.Text = name.Value
text.FontSize = "Size12"
text.Size = UDim2.new(1,0,1,0,0,0)
text.BackgroundTransparency = 1
text.TextColor3 = BrickColor.new("White").Color
text.TextStrokeColor3 = BrickColor.new("Balck").Color
text.TextStrokeTransparency = 0
name.Changed:connect(function(newName)
text.Text = newName
end)
end)
end)
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage.ChangeName
event.OnServerEvent:connect(function(player, newName)
player:findFirstChild("RPName").Value = newName
end)
TextFilter Server Script:
local replicatedStorage = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")
local event = replicatedStorage.FilterText
event.OnServerInvoke = (function(player, textToFilter)
local filteredTextResult = TextService:FilterStringAsync(textToFilter, player.UserId)
return filteredTextResult:GetNonChatStringForBroadcastAsync()
end)
Be sure to follow me on Twitter after subscribing!
https://twitter.com/Rrrrry123
Also, follow me on Twitch for some live streams!
http://www.twitch.tv/Rrrrry123
Other Videos By RyGuyGaming
Other Statistics
Roblox Statistics For RyGuyGaming
At present, RyGuyGaming has 459,946 views spread across 106 videos for Roblox, and roughly a days worth of Roblox videos were uploaded to his channel. This makes up 17.76% of the content that RyGuyGaming has uploaded to YouTube.