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

How to make a name/ group only door?

Asked by 9 years ago
local config = script.Parent.Configuration

script.Parent.Touched:connect(function(part)
    if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
        local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
        if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
            script.Parent.CanCollide = false
            if player.grouprank = false then player.Humanoid.Health = 0
            if player.Username = "noob1126" then player.humanoid.Health = 100
            wait(1)
            script.Parent.CanCollide = true
        end
    end
end)

This does not work. I am trying to make it so me and group members above a certain rank can enter and if the door is open for a brief second and you're are not in the group rank > above or me then you die. Attached to this is the configurartion folder and the group part works so I just need the "Kill when open" so when door.CanCollide = false, and adding my name in there so I dont die.

~Thanks a ton for the help, Noob1126

1 answer

Log in to vote
1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

In line 8 and 9, you tried accessing imaginary properties. Also, you made a few capitalization errors.

local config = script.Parent.Configuration

script.Parent.Touched:connect(function(part)
    if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
        local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
            if (player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value) then
                script.Parent.CanCollide = false
                wait(1)
                script.Parent.CanCollide = true
                if player.Name:lower() == "noob1126" then
                    player.Character.Humanoid.Health = 100
                end
            else
                --if not player:IsInGroup(config.GroupId.Value) then
                player.Character:BreakJoints() -- Same as killing
                --end
        end
    end
end)

0
Thank you soooooo much! this really helped me, I am new at scripting so this help really does help. noob1126 34 — 9y
0
Glad I could help! Shawnyg 4330 — 9y
0
Oh yeah forgot to ask you, if someone touches this and it is NOT open, will it kill them? Cause I was hoping no. noob1126 34 — 9y
Ad

Answer this question