--something went wrong with this script, help me fix it
door1 = script.Parent
Defender = BrickColor.new("Bright green")
Raider = BrickColor.new("Fossil")
function door(plr)
if plr.TeamColor == Defender then
door1.Transparency = 1
door1.CanCollide = false
wait(2)
door1.Transparency = 1
door1.CanCollide = true
elseif plr.TeamColor == Raider then
door1.Transparency = 1
door1.CanCollide = true
r = plr.Name
m = Instance.new("Hint")
m.Parent = game.Workspace
m.Text = r.."Is Trying To Enter The Defender Spawn!"
wait(5)
m:remove()
end
end
door1.Touched:connect(door)
COMMUNITY QUESTION
how do i make a door that only lets one team through and blocks the other team?
1 answer
door1.Touched:Connect(door) <-- Suggestion, use Connect with a capital C
function door(plr)
the so called plr here isn't actually the player, its whichever part that touches Door1. To get the actual "plr", its just game.Players:GetPlayerFromCharacter(plr.Parent). Only then, the script can detect the TeamColor of the player
This discussion is preserved as it was. New answers, comments, and votes are closed.
