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

Rank door do not work for a rank it is supposed to work, but it works for an higher rank. Why?

Asked by 4 years ago
Edited 4 years ago

Here is the script:

01local GroupId = 4565372
02local RankId = 6
03 
04script.Parent.Touched:connect(function(part)
05    if part.Parent and game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
06        local player = game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
07        if player:GetRankInGroup(GroupId) >= RankId then
08            script.Parent.Transparency = 0.8
09            script.Parent.CanCollide = false
10            wait(0.65)
11            script.Parent.Transparency = 0.5
12            script.Parent.CanCollide = true
13        end
14    end
15end)

It does not work for the rank with the rankid 6, but works for a rank with the rankid 255 (the owner), but when the rank with the rankid 6 tries to pass the door, the door changes transparency but does not let the player.

0
i tried the script and it works just fine SpeedyTV_1 88 — 4y
0
Really? JOZOUMRO11 34 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Try to pcall the code. pcalling tests the code if there is an error, if there is, it'll print it to the output. I hope it helps. i wasn't able to find the problem.. good day!

01local s, e = pcall(function()
02local GroupId = 4565372
03local RankId = 6
04 
05script.Parent.Touched:connect(function(part)
06    if part.Parent and game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
07        local player = game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
08        if player:GetRankInGroup(GroupId) >= RankId then
09            script.Parent.Transparency = 0.8
10            script.Parent.CanCollide = false
11            wait(0.65)
12            script.Parent.Transparency = 0.5
13            script.Parent.CanCollide = true
14        end
15    end
16end) end) if not s == true then warn(e) end --this will print the error in the output in orange,
17--I wasn't able to find it :(
Ad

Answer this question