How can I make options to change text content on this SurfaceGui only for one team

For example: I have text on part like this and if my team is eg “Police” i can edit this text in roblox game. Im trying to do this, but I failed
image

Can somebody help me? Please

I think you could:

  • Get the players
  • Check if they are in a certain team
  • If they are, display the specific text
  • If not, don’t display the specific text

It’s a good start, but I want to be able to type what I want manually

You can make a localscript that will replace text with the text you want, like:

PathToReplicatedEvent.OnClientEvent:Connect(function(Text:string)
    PathToTextLabel.Text = Text
end)

You can fire that event only for team members

I don’t understand this post, do you want the player to be able to change the text or it changes text when a player is on a specific team?

I want player be able to change text if his team is eg police

Oh, ok heres an idea. I assume you’re using TextBox. So you’re going to have to use this function, (and I could guess this is a local script so use remote events)
This is in local script

local textboxtext = textbox.Text --we need this for remotevent
Textbox.FocusLost:Connect(function()
     remoteevent:FireServer(textboxtext) --fires the remote event
end)

Now this is a ServerScript we’re going to be using. We are going to get the remote event.

local Teams = game:GetService(“Teams”) --variable for teams
remoteevent.OnServerEvent:Connect(function(player, textboxtext) --now we have the text
      if player.Team == Teams.Police then
      print(“Player is on Police team team”)
      textbox.Text = textboxtext
   end
end)

Thank you, it was help me,

Dont read this, devforum want long reply

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.