I attempted to make it so when the player gets off the block it prints "not touching anymore" but it does not print
I decided to try this because the .TouchedEnded event is trash and doesnt work all the time ;(
script.Parent.Touched:connect(function(hit) if hit.Parent:WaitForChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) local coins = plr:WaitForChild("leaderstats"):WaitForChild("Coins") local candy = plr:WaitForChild("leaderstats"):WaitForChild("Candy") touching = true CEopen:FireClient(plr) while touching do wait(1) local touchingparts = script.Parent:GetTouchingParts() for i,v in pairs(touchingparts) do if v.Parent:WaitForChild("Humanoid") == nil then print("not touching anymore") end end end end end)
On line 12 you use WaitForChild. That will actually "block" what you are doing and the script will at that point wait until all children that are touching the part have a Humanoid child.
if v.Parent:WaitForChild("Humanoid") == nil then
You will want to change that to FindFirstChild.
if v.Parent:FindFirstChild("Humanoid") == nil then