Binable Event not Firing

So basically when a player click a Gui button, it fires a remote event and this script receives it and waits until a player touches that part, and if a player does, it checks if that player is in a certain team. then it should fire a bindable event, but thats not happening.

-- serverscript part
game.ReplicatedStorage.JoinAteam.OnServerEvent:Connect(function(player)
  script.Parent.Touched:Connect(function()
     if player.Team == "i" then
      game.ReplicatedStorage.Terminate:Fire()
      print("ya")
     end
   end)
end)

Thanks!

game.ReplicatedStorage.JoinAteam.OnServerEvent:Connect(function(player)
  script.Parent.Touched:Connect(function()
     if player.Team == "i" then
      game.ReplicatedStorage.Terminate:Fire()
      print("ya")
     end
   end)
end)

idk if thats the issue but it seems pretty problematic.

If you dont know what I did, you missed a " after “i”

Oh I think I accidentally deleted that when I made this post, but in my script in studio it is fixed

Where is that server script located at

I don’t believe this is a very good way to check a player’s team. There are two ways to check a player’s team: you check a player’s teamcolor like this…

if player.TeamColor = BrickColor.new("a good color") then

or

if player.Team = game:GetService("Teams").i -- i is whatever team it maybe

hope this helps!

My next question would be is it printing “ya”

In a part (30 charsssssssssssss)

player.Team == “i” should be player.Team.Name == “i”

Why can’t you check what team there are in by

player.Team.name

?

…hmmm…
I don’t know, but I think you just found a solution to your problem, you forgot to add .Name

Bruh I should have figured this out… Anyway thanks for pointing out my mistake

1 Like