end) <what do you think this is?
end) <what do you think this is?
ik check this
you dont need another function
i think you do 30 charssssss
just go to the wiki, like you’re pulling all this information you don’t understand
: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.
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.
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
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
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
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.
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.
Can i have a code example so i can implement this
True, but if this is what he prefers or wants, I would gladly try to help him. He may change it in the future, but my primary goal here is to help him fix his errors.
The code works and knows that I touched the part and it also printed that it worked but it did not make the button gui non visible. This my current code:
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 runservice = game:GetService("RunService") function CheckIfPlayerIsInArea() local touching = Part:GetTouchingParts() for i=1,#touching do if touching[i] == game.Players.LocalPlayer.Character.HumanoidRootPart then game.Workspace.CheckParts.count.Value = true if game.Workspace.CheckParts.count.Value == true then CurrentStage.Visible = false end return true end end return false end runservice.Stepped:Wait() wait(5) while true do wait(2) Part.Touched:Connect(function() end) CheckIfPlayerIsInArea() end
Is this a local script or a server script?
local script 30