I am trying to create a town naming script, like in Animal Crossing. This script is unfinished, and what I want to know is, is it reliable?
This script runs on the client, after the button has been clicked.
local replicatedStorage = game:GetService("ReplicatedStorage") local filterFunction = replicatedStorage.FilterTextBox local player = game:GetService("Players").LocalPlayer local box = script.Parent.Parent.TownName script.Parent.MouseButton1Click:Connect(function() local filteredText = filterFunction:InvokeServer(box.Text) box.Text = filteredText script.Parent.Parent.Parent.PlaceFilter.Visible = true script.Parent.Parent.Parent.PlaceFilter.TextLabel.Text = "Your towns name is going to be <b>".. filteredText.. "</b>. Are you sure? You cannot change this later. " end)
This script runs on the server, and filters the text, then returns the filtered text
local rep = game:GetService("ReplicatedStorage") local txtSer = game:GetService("TextService") local filterFunction = rep.FilterTextBox local filteredText filterFunction.OnServerInvoke = function(plr, unfilteredText) filteredText = txtSer:FilterStringAsync(unfilteredText, plr.UserId) return filteredText:GetNonChatStringForBroadcastAsync() end
If this is the most reliable this script it can be, great! Let me know otherwise on what I should change to make it reliable. Thank you, WE