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

Why doesn't it let me walk through?

Asked by 10 years ago
function onTouch(Player)
    if GetRankInGroup(947529) >= 9 then
        script.Parent.CanCollide = false
        wait (1)
        script.Parent.CanCollide = true
    end
end

script.Parent.Touched:connect(onTouch)

2 answers

Log in to vote
1
Answered by 10 years ago

...Fixed.

function onTouch(hit)
    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
    if plr == nil or plr:GetRankInGroup(947529) < 9 then return end
    script.Parent.CanCollide = false
    wait(2)
    script.Parent.CanCollide = true
end

script.Parent.Touched:connect(onTouch)

0
THx snoppyploptart 59 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

If the above doesn't work, use the same answer as what Code used and add: 1) outside of the function put ~~~~~~~~~~~~~~~~~ debounce = false

Right under
 ~~~~~~~~~~~~~~~~~
if plr == nil or plr:GetRankInGroup(947529) < 9 then return end

add:

debounce = true

also under

script.Parent.CanCollide = true

add:

debounce = false

This is all only if the answer above doesn't work, the answer corrects a mistake but I don't have time to test it so I am just giving you a solution if the answer doesn't work.

0
Im just saying, it worked for me for a team-only door, no reason to click down the rating. PureDefiance 20 — 10y

Answer this question