If Player is in an area

That doesn’t answer my question, you still only need 1 function

but you need the touch interest for the function to work

yeah the touched is a function itself

ik but it make a touch interest which you need for the other function

script.Parent.Touched:Connect(function()

end) <what do you think this is?

ik check this

you dont need another function

1 Like

i think you do 30 charssssss

just go to the wiki, like you’re pulling all this information you don’t understand

1 Like

:GetTouchingParts() does not work on characters as the legs and arms are non-colide, therefore if you want to have to do methods like so which @buildthomas showed previously:

Alternatively, you might want to look into regions instead as they can provide the same relative ideology and encompass the same logic.

1 Like

I’ll explain. The reason why @TheDragonSlayer5481 added a Touched function is to also register Non-Collideable parts. GetTouchingParts will only return parts who’s property CanCollide is true. However, by adding a touch interest, it will register the part despite not having a CanCollide true.

Also, I see you have 2 variables that has the same name as “Part” (In a local variable and parameter).

And when you did CheckIfPlayerIsInArea(), you didn’t add a part argument.

1 Like

You may want to use .magnitude:

local check = workspace.CheckParts
local player = game.Players.LocalPlayer
local stage = player.leaderstats.Stage
local Part  =check[stage.Value]
local CurrentStage = game.StarterGui.MainGui.Teleporters.Frame["Current Stage"]

local magnitude = (player.Character.HumanoidRootPart.Position - Part.Position).Magnitude
if magnitude == 0 then
CurrentStage.Visible = false
else
CurrentStage.Visible = true
end

Magnitude detects the distance between the players position and the parts position. It helps in these situations.
Hope it helped

1 Like

this is because the part , check[stage.Value], when i try to put it in the parameters it does not work

Then maybe you should remove the “Part” from function CheckIfPlayerIsInArea(Part,Character) .

Another note, be sure to disconnect the Touched function after you did GetTouchingParts.

1 Like

This helps, but i do not want the player to have the exact position but within a certain area.

but that doesn’t make any sense to me > why not just use raycasting at that point

1 Like

Could you help me and show me a script example on how to do that?

A Raycast is a line, while he is trying to make a sort of area. This would require a lot of Raycast.

1 Like

you can use raycast with magnitude ya know? additionally you could use region3 to make an area. Like theres so many better ways to do this.

1 Like

Can i have a code example so i can implement this