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
1function onTouch(Player)
2    if GetRankInGroup(947529) >= 9 then
3        script.Parent.CanCollide = false
4        wait (1)
5        script.Parent.CanCollide = true
6    end
7end
8 
9script.Parent.Touched:connect(onTouch)

2 answers

Log in to vote
1
Answered by 10 years ago

...Fixed.

1function onTouch(hit)
2    local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
3    if plr == nil or plr:GetRankInGroup(947529) < 9 then return end
4    script.Parent.CanCollide = false
5    wait(2)
6    script.Parent.CanCollide = true
7end
8 
9script.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

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

add:

1debounce = true

also under

1script.Parent.CanCollide = true

add:

1debounce = 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