local function two()
while true do
for i,v in pairs(game.Workspace.Tiles:GetChildren()) do
v.CanCollide = true
local touchingparts = v:GetTouchingParts()
for index, value in ipairs(touchingparts) do
if value.Parent:IsA("Model") and value.Parent:FindFirstChild("Humanoid") then
local player = value.Parent:GetPlayerFromCharacter(value.Parent)
v.BrickColor = player.Color.Color.Value
end
end
end
wait(0.1)
end
end
coroutine.resume(coroutine.create(two))
This doesn’t work, but it doesn’t show any errors. I’m sure that my mistake is simple and easy to fix, for this is the first time that I have used :GetTouchingParts().
All parts returned with BasePart:GetTouchingParts must have a .Touched event connected to them. I would just connect a touched event with an empty function on all of the parts that you need to check against. Do be careful with how many of these you create though!
EDIT: My bad! It’s all CanCollide = false parts, not all parts!
You are getting the player that touched it right? R15 Character’s Feet are cancollide false so the GetTouchingParts() wouldnt work and R6 Character’s legs are cancollide false so again, GetTouchingParts() wont work
You could use .Touched for the parts, but im saying GetTouchingParts() Only returns parts that collide with it, so if the character walks on a tile, its not going to return the part of the character that touched it because their feet are CanCollide false, if the Tile is CanCollide false then nothing can collide with it so that wouldnt work
He had it in a loop so I just assumed he wanted it to be in a loop for a reason, so I recommended using Region3
local function two()
while true do
for i,v in pairs(game.Workspace.Tiles:GetChildren()) do
v.CanCollide = true
local touchingparts = v:GetTouchingParts()
for index, value in ipairs(touchingparts) do
local Hit = workspace:FindPartsInRegion3WithIgnoreList(v,{},1)
if Hit.Parent:IsA("Model") and Hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
print(player)
v.BrickColor = player.Color.Color.Value
end
end
end
wait(0.1)
end
end
coroutine.resume(coroutine.create(two))
@bronsonman Revised code above still doesn’t work. What did I do wrong?
okay sorry again, you dont have to have it in a loop, my brain is just not functioning correctly right now, just make sure you created the region3 in the correct spot