I have been working on a game and I wanted a part where players on one team can walk over a block while players on another team fall through it. I was going to make it so that if a player from the team I want to be able to stand touched it the script would set "can collide" to true and when they weren't on it "can collide" would be set to off. However this would mean that if that player was on the block then the other team would be able to cross it until they got off. this would create problems and make things too easy. I don't even know if it is possible to even make a script like that. I tried plugging a few promising script parts into the end of this one:
script.Parent.Touched:connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player and Player.TeamColor == BrickColor.new("team color") then
(script end) to try and get the results I wanted to no avail. I had even tried the free models section. Now i'm at my ropes end, so I came here to ask for help.

2 comments
What if 2 people on both teams go in at the same time. The script won't work then because both of them can't go through!
If some random block that isn't the player touches it then it won't work either! hit.Parent if it's a part in workspace will give you the workspace datamodel, which isn't a character and will error.