Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a name/ group only door?

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

✓ Accepted answer

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)

3 comments

0

Thank you soooooo much! this really helped me, I am new at scripting so this help really does help.

0

Glad I could help!

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.