Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How should i detect objects inside a part?

Asked by 7 years ago

I was using touched event , but the problem is when the part that is sensible to touch isnt moving, it requires the other parts (characters, etc..) to move and touching. Problem arrises when the part sensible to touch gets created and CFramed in a position that makes the character inside the part... If the character doesnt move, touch event doesnt get triggered. Is there an alternative solution?

0
use the parts position, and size. Also the players position to detect if the player is in the part, I hope that helps. TheGreatSailor 20 — 7y
0
Run a loop in the touched event then use the TouchEnded event to stop it. Lord_CthuIhu 2 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
01local Parts = {}
02 
03script.Parent.Touched:connect(function(Hit)
04    local Add = true
05    for i,v in pairs(Parts) do
06        if v == Hit then
07            Add = false
08        end
09    end
10    if Add == true then
11        table.insert(Parts, Hit)
12    end
13    coroutine.resume(coroutine.create(function()
14        while wait() do
15            for i,v in pairs(Parts) do
View all 28 lines...
0
so.. I believe this isnt an answer to my question. for that to be activated, it needs a touch event, which isnt triggered in the case of the parts staying still. But thanks Kiriyato 15 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Isn’t there a way besides that messed up geometry scripting?

Answer this question