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

Can touched event detect players with cancollide off?

Asked by 5 years ago
Edited 5 years ago

I need to check if a player is in a zone, but when i come into the brick, nothing is appearing in the console.

b = true
script.Parent.Touched:Connect(function(hit)
    print("you touched me :(")
    if game.Workspace.Temp.Errored.Value and b then
    p = 1
    b = false
    local a = hit.Parent:FindFirstChild("Humanoid")
    if a ~= nil and p == 1 then
    wait(5)
    game.Workspace.Pipes.Pipe1.Transparency = 1
    game.Workspace.Pipes.Pipe2.Transparency = 1
    game.Workspace.Pipes.Pipe3.Transparency = 1
    game.Workspace.Pipe1.Transparency = 0
    game.Workspace.Temp.Errored.Value = 0
    game.Workspace.Temp.Errored2.Value = 0
    wait(10)
    b = true
end
end
end)

script.Parent.TouchEnded:Connect(function()
    print("you stopped touching me :)")
    p = 0
end)

It does detect touches from other parts, though. In here it says that invisible detection is a thing. EDIT: After some time this problem disappeared, weird

0
Why are you checking if Temp.Errored.Value equals true? User#19524 175 — 5y
0
Boolvalue. SBlankthorn 329 — 5y
0
But on line 14, OP assigns Errored.Value to zero. User#19524 175 — 5y
0
Other stuff in the game makes Errored.Value true, "you touched me" is not appearing when I get in the brick User#23477 0 — 5y
0
Okay, after some time it started working. Not sure what was wrong though. User#23477 0 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

Yes, Even with CanCollide off, it can still detect players.

0
This should be a comment, make this worth being an answer. User#19524 175 — 5y
0
But how? Why is this not working then? User#23477 0 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Simple answer: Yes yes it can

Long answer: The part is still being touched, even with transparency 0 and cancollide set to false, therefore the ontouched event will still fire. You can try this in a brick that has 0 transparency and cancollide set to false to be sure:

script.Parent.Touched:Connect(function(hit)
print(hit.Parent.Name)
end)
--if it prints the player name then it works, which it should

Answer this question