I just got help on the following script, and it works fine.... Well there is one problem. Okay, so lets say I'm on the "Blue Team." I will get killed and that message will pop up. Lets say I switch to the "Red Team." The same will happen when I touch that wall. And now if I change to the "Taxi Driver" team I will go through fine. Yay, all works, but, if I change teams after becoming a taxi driver, I can still go through the wall unharmed and there is no GUI. Here is my script, maybe you can help me figure it out so that even after I become a taxi driver and change teams I cannot enter the wall/door. Does it help that the door is set to "not Collide" before all of this, and I want to keep it like this, so that cars can pass through the wall/door . Thanks!
local Door = script.Parent
debounce = false
local modelname="Taxi Driver"
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:FindFirstChild("Humanoid")
if (human ~= nil ) and (debounce == false) then
if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor==game.Teams:FindFirstChild(modelname).TeamColor then
debounce = true
Door.Transparency = 1
wait(1)
Door.Transparency = 1
else
human.Health = 0
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local gui = Instance.new("ScreenGui", plr.PlayerGui)
local message = Instance.new("TextLabel", gui)
message.Size = UDim2.new(1, 0, 1, 0)
message.BackgroundTransparency = 0.5
message.Text = "Player was not a Taxi Driver"
wait(5)
message:Remove()
end
end
end
Door.Touched:connect(onTouched)
debounce = false
