A quick question

So basically when a player touches a certain part, I check if the player is on a certain team, and if they are, fire a remote event to the client and from there change text on the billboard gui. Unfortunately, it didn’t work, so I thought, should I use a bindable event instead and change the text from the server? Or should I still change the text from the client. (The reason I’m changing the text from the client is because I only want the text to change for one person.) If you need more details, here are my scripts

-- serverscript in part
game.ReplicatedStorage.JoinAteam.OnServerEvent:Connect(function(player)
  script.Parent.Touched:Connect(function()
     if player.Team.Name == "Bob" then
      game.ReplicatedStorage.Terminate:FireClient(player)
     end
   end)
end)
-- local script in starter gui
local Tag = game.ReplicatedStorage.NameTag
local Term = Tag.UpperUpperText
game.ReplicatedStorage.Terminate.OnClientEvent:Connect(function(player)
    Term.Text = "T" 
end)

Why are you connecting a Touched event via a RemoteEvent?

Because I only want the touched event to run after something else happens

This check is very vulnerable to exploiters as they can just fire the event and cause a very very large amount of connections.

1 Like

How do I fix it? (30 chars)))))

1 Like

Before fixing, I need to know why you are creating the Touched event in the first place.

  1. Is it when certain conditions in a local script is met?
  2. Did you try alternative solution instead of creating the Touched connection via RemoteEvent?

This is how it is supposed to work

something triggers the remote → the touched event can now run → if the thing that touched the part is in team ‘bob’ → Fire another remote event, this time to the client → from the client change the name tag

Why not just attach a Touched connection in the part already then do all necessary checks then fire to the client?

Hmm so like this?

script.Parent.Touched:Connect(function()
     game.ReplicatedStorage.JoinAteam.OnServerEvent:Connect(function(player)
     if player.Team.Name == "Bob" then
      game.ReplicatedStorage.Terminate:FireClient(player)
     end
   end)
end)

No:

script.Parent.Touched:Connect(function()
    if player.Team.Name == "Bob" then
    game.ReplicatedStorage.Terminate:FireClient(player)
    end
end)

Now it runs an error: 08:30:23.839 - Team is not a valid member of Part

It means it thought Team is a child. To fix this, get the player from the 1st parameter of Touched:

script.Parent.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if not player then return end
    if player.Team.Name == "Bob" then
        game.ReplicatedStorage.Terminate:FireClient(player)
    end
end)

Ok so should I use a bindable event to fire to another serverscript and change the nametag, or should I use a local script

I don’t get what you are trying to do, as your only problem is not being able to fire the RemoteEvent. If it is not related to the current problem, it should go to another topic.

That is the original question I was asking. Also, I’m talking about this line:

If you want to show a new text to the client’s own UI, then you need to use a RemoteEvent.

Then how come its not working?

Did the OnClientEvent got fired? If not, you can always debug it by adding prints.

I already tried that and everything prints, but the text doesn’t show. (Also the billboard gui is in replicated storage)

Is the GUI cloned to the player’s GUI or anywhere that the player can see?