So my aim is to make a zone-capture thing: I want to detect a player, get his/her team, then change the colour of the zone to the team colour.
I have this:
local regionPart = game.Workspace.BoundaryZone
local pos1, pos2 = (regionPart.position - (regionPart.Size/2)), (regionPart.position + (regionPart.Size/2))
local region = Region3.new(pos1, pos2)
while true do
wait(1)
local partsInRegion = workspace:FindPartsInRegion3(region, game.Workspace.Baseplate,1000)
local playersFound = {}
for i, v in pairs (partsInRegion) do
if v.Parent:FindFirstChild("Humanoid") ~= nil then
print("Player found in region!", v.Parent.Name)
playersFound[v.Parent.Name] = v.Parent
table.insert(playersFound, v.Parent)
end
end
for i, vin pairs (playersFound) do
spawn(function()
--[[if v.TeamColor == game.Teams.Peace.TeamColor then
wait(2)
zone.BrickColor = v.TeamColor ]]--
end
end)
end
end
The script I have detects the parts that make up the player's character, but as I said I want the overall player so I can change his/her team. I'm guessing I need to use "GetPlayerFromCharacter" but idk where to slip it in?
Many thanks for reading

1 comment
Yeah the GetPlayerFromCharacter will work well with the touched event i tell you to make np bc that's how you get their team