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

Trying to make a rank exclusive door, it won't work?

Asked by 6 years ago

Basically, I'm trying to create a rank exclusive door. When the character touches the door, I want the property can collide to be false if they are a certain rank. It doesn't work, I know I'm doing something horribly wrong.

This is the error: GetRankInGroup is not a valid member of Part

(I feel annoyed with myself that I have to keep on asking questions on this site because of my poor script knowledge, I'm sorry but I don't want to use scripts online)

Script: Regular Script


function rank(player, hit) if player:GetRankInGroup(4266272) == 0 then script.Parent.CanCollide = true else script.Parent.CanCollide = false end end script.Parent.Touched:connect(rank)

And if someone could properly explain services, get services and things like that (simply) that'd be great! I'm still learning about that, and no wiki site can explain it clearly enough for me.

0
It’s Connect not connect. User#19524 175 — 6y

2 answers

Log in to vote
-1
Answered by
Diltz_3 75
6 years ago
Edited 6 years ago

In your script you needed to get player from Touched use function :GetPlayerFromCharacter(examplefunction.Parent)

Example:

local PartTouch = script.Parent
local GroupID = 0
local RankID = 0

PartTouch.Touched:connect(function(plrhit)
    if plrhit.Parent:FindFirstChild("Humanoid") then
        local Player = game:GetService("Players"):GetPlayerFromCharacter(plrhit.Parent)
        if Player:GetRankInGroup(GroupID) >= RankID then
            PartTouch.CanCollide = false
            wait(1.5)
            PartTouch.CanCollide = true
        else
            PartTouch.CanCollide = true
        end
    end
end)

Also. CanCollide = true enables collision. use false

0
It’s Connect not connect, stop giving OP deprecated code. User#19524 175 — 6y
0
I'm using connect and this works. ;-; Diltz_3 75 — 6y
0
No, it's connect. Andreaaaaxo 6 — 6y
0
I enabled collision because the rank 0 was a guest.. is there any way to do multiple ranks? Andreaaaaxo 6 — 6y
0
>= using it means if player has rank 9 or higher it will work Diltz_3 75 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

game.Players:GetPlayerByCharacter(player) at the start of the function

0
i mean GetPlayerFromCharacter*** RealProgrammerL_L -1 — 6y

Answer this question