Detecting if a Player is Touching a Part

I am making a script that causes a part to grow as long as you are standing on it.
The problem is whenever I stand still, it doesn’t grow; it only grows when I move.

Script

local C = script.Parent:GetChildren()
local E = false

for i = 1,#C do
	if C[i].Name == "Tile" then
		C[i].Touched:Connect(function()
			if E == false then
				print("Touched")
				E = true
				C[i].Size = Vector3.new(9, C[i].Size.Y + 1, 9)
				wait(1)
				E = false
			end
		end)
	end
end

Alright I think I found the solution:

local C = script.Parent:GetChildren()
local E = false

for i = 1,#C do
	C[i].Touched:Connect(function()
		E = false
		while E == false do
			wait()
			print("Touched")
			C[i].TouchEnded:Connect(function()
				E = true
			end)
		end
	end)
end

Hope this helped!

The tiles grow too fast and clip through the player.

You can set the wait() to however long you want

I did. The parts still grow too quickly.

Every time I add a wait, it stops working.

You can simple use the BasePart:GetTouchingParts() method to find if it’s touching a tile. It would only work if the tiles can collide.

for _, limb in next, character:GetChildren() do
    if limb:IsA("BasePart") then
        for _, part in next, limb:GetTouchingParts() do
            if part.Name == "Tile" then
                print("player is touching", limb, part)
            end
        end
    end
end

I have the script inside of the model that has the tiles in it. How would I get the character?

There are multiple ways to get the character. Some are by using player.Characater, another is using a remote event to pass the character argument or player arg so you can use player.Character, or you can use player added and character added.