I need you to tell me, this script what need?

Hello Community, what I plan to do, is to put a “Tag Chat”, to people who have the premium. Therefore there is something that comes out a mistake.

Screenshot_32

This is a LocalScript left in “StarterCharacterScripts”

I suppose you need to define the variable speaker.

How can I do it? I dont understand

Did you use a video tutorial for the script or did you make it on your own?

speaker is not defined anywhere in the script. Are you following a tutorial?

Yes, but I can’t do it. How can I define the speaker?

You need to make the variable exist.

local speaker = "variable"

It won’t be a string (text) but can you explain what the speaker is suppose to be?

1 Like

Your script is unsafe as exploiters can already exploit it.

1 Like

Do you even learn the basics of scripting or you’re just copying the script?

2 Likes

That shouldn’t be in a local script, that should be in ServerScriptService.

From the screenshot you provided, it seems you’ve only written down what you thought you needed from the tutorial. Without knowing the entire script, I can’t fully help you.

If this is based on ChatService.SpeakerAdded, you can define speaker by using the :GetSpeaker method of ChatService, with the value that was returned by the .SpeakerAdded event as the argument.

Example
ChatService.SpeakerAdded:Connect(function(playerName)
	local speaker = ChatService:GetSpeaker(playerName)
end)

Apologies if this is inaccurate, I’m really tired right now.

Edit: I figured you’re using a LocalScript for this. You’ll have to move your code to a Script under ServerScriptService if you want this to be visible to other players.

1 Like

It defines “localplayer” so it is suppose to be in a local script, it will just not replicate (I know what you’re saying) he is likely watching an old tutorial before FE.

@SimplyConst is right. If you’ve copied this from a tutorial without knowing what all of this is, we can’t help you really.

1 Like

Yes, but you can do the same from a server script, as it’s more secure and easier.

1 Like

The script will not replicate and even if it did, it would be easily exploitible. The tutorial you’re watching is likely from 2016. Considor using a different tutorial, and like others said, we can’t help you if you copied it all from a tutorial.

Exactly what I wanted, see if the TagColor turns out to be a mistake…
.

And skimming the script here, the code you have is kinda inefficient, you shouldn’t get a player from it’s name, but rather it’s UserId.

2 Likes

Also if you don’t know what I mean by “replicate”, it will not show to anyone else if it is in a localscript. You should do this in a server script. (Exploiters can view scripts that replicate to the client btw.)

1 Like

You missed a comma after TagText = "Premium".

local tags = {
	TagText = "Premium",
	TagColor = Color3.fromRGB(0, 0, 0)
}
1 Like

I have an idea, how about in the tags table, you should put the user’s UserId, and their tag info, something like this:

local tags = {
[USERIDHERE] = {TagText = "CHATNAMETAGHERE", TAGNAMEHERE = Color3.fromRGB(COLOR3VALUEHERE)};
}
2 Likes