i have this script: THIS SCRIPT IS IN A TEXT LABEL, WICH IS IN A SURFACE GUI, WICH IS IN THE ACTUAL PART
01 | local part = script.Parent.Parent.Parent |
02 | local numTouchingParts = 0 |
03 | local playersTouching = { } |
04 | part.Touched:Connect( function (hit) |
05 | if hit.Parent:FindFirstChild( "Humanoid" ) then --checks to make sure it is a player |
06 | local c = hit.Parent |
07 | if not playersTouching [ c ] then --if the player is not already touching the part, add them to the table and increment numTouchingParts by one |
08 | table.insert(playersTouching, c) |
09 | numTouchingParts = numTouchingParts + 1 |
10 | end |
11 | end |
12 | end ) |
13 |
14 | part.TouchedEnded:Connect( function (hit) |
15 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
but nothing happens.. can i get some help?
01 | local Players = game:GetService "Players" |
02 | local function getPlayersOnPart(regionPart) |
03 | local pos 1 = regionPart.Position+Vector 3. new( 0 ,. 3 , 0 ) - (regionPart.Size / 2 ) |
04 | local pos 2 = regionPart.Position+Vector 3. new( 0 ,. 3 , 0 ) + (regionPart.Size / 2 ) |
05 | local region = Region 3. new(pos 1 , pos 2 ) |
06 | local partsInRegion = workspace:FindPartsInRegion 3 (region, nil , 1000 ) |
07 | local tab,x = { } , 0 |
08 | for _, v in ipairs (partsInRegion) do |
09 | local char = v.Parent |
10 | local hum = char and char:FindFirstChildOfClass "Humanoid" |
11 | local player = hum and Players:GetPlayerFromCharacter(char) |
12 | if player and not tab [ player ] then |
13 | tab [ player ] = true |
14 | x+ = 1 |
15 | end |