Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this script filter the text correctly and display on the status bar?

Asked by 6 years ago
-- JoshTheDarkOne --

local button = script.Parent
local textbox = button.Parent.EnterShout
local shout = game:GetService("ReplicatedStorage"):WaitForChild("Shout")
local TextService = game:GetService("TextService")

for i,v in pairs(game.Players:GetPlayers()) do
    player = v.userId
end

button.MouseButton1Click:connect(function()
    local filteredText = TextService:FilterStringAsync(textbox.Text, player)
    filteredText = shout.Value
end)

The status bar is working and I have proved that by changing the value!

0
yay terrible game security hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
button.MouseButton1Click:connect(function()
    local filteredText = TextService:FilterStringAsync(textbox.Text, player)
        filteredText = shout.Value
end)

You are attempting to change filteredText to the shout.Value, and not the other way round. As well as this, it seems TextService filtering requires the user id, so just change (textbox.Text, player) to (textbox.Text, player.UserId). Just something to note, I can see this is from a GUI. If you're not filtering-enabled (Experimental Mode on), just make sure the script is a server script and not a local script. If it is a 'normal game', you'll need to send to a server script using a RemoteEvent/RemoteFunction to be able to use TextService.

If you require any more assistance, let me know.

Ad

Answer this question