How to make a Admin Bypass for this door?

Hi,

how can i make a adminbypass (with userid) for this door? All players (not the owner from the tycoon) will get killed if the door is activated. But i want that I (admin) can walk through a activated door. But how can i make that? Can someone edit the script and send it back?

local ownerID = 1240678162

function touc(part)
	local plr = game.Players:FindFirstChild(part.Parent.Name)
	if plr then
		local h = part.Parent:FindFirstChild("Humanoid")
		if h then
			if val.Value == true then
				if part.Parent.Name ~= script.Parent.Parent.Parent.Parent.Parent.Owner.Value.Character.Name then
					h.Health = 0
				else if part.Parent.UserId == ownerID then
						part.Parent:FindFirstChild("Humanoid").Health = 100
					end
				end
			end
		end
	end
end
script.Parent.Touched:connect(touc)

Thanks!

1 Like
local ownerID = --ID Here

script.Parent.Touched:Connect(functon(h)
 if h.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(h.Parent).UserId ~= ownerID then
  h.Parent.Humanoid.Health = 0
 end
end)
1 Like

that would not work this are only a few lines from my script

1 Like

You said you wanted it to kill people who aren’t you, that’s exactly what that does.

1 Like

no i want that the tycoon owner will dont get killed too

2 Likes

Okay then just make it a table

local IDs = {ID,ID} -- add IDs here as you please 

script.Parent.Touched:Connect(functon(h)
 if h.Parent:FindFirstChild("Humanoid") and not table.find(IDs,game.Players:GetPlayerFromCharacter(h.Parent).UserId) then
  h.Parent.Humanoid.Health = 0
 end
end)

@Chatowillwin is correct I think, his script should allow only the owner to walk through the part.

no you didn’t understand. I mean the tycoon owner not the game owner. The script from the door is right but i only want that you add that i can walk through. But dont change the script only add something i think.

2 Likes

but this isnt that what i want

1 Like

Ah, do you have a way of determining who the tycoon owner is?

1 Like

of course, its in the script. There is a Owner Value

1 Like

if part.Parent.Name ~= script.Parent.Parent.Parent.Parent.Parent.Owner.Value.Character.Name then

@Chatowillwin script uses that value…

I think im misunderstanding completely

1 Like

Assume that the tycoon’s owner ID was nil from the beginning, the ownership touch brick should change the owner ID to the player who touched it. A secondary check is needed for admins and others.

For a secondary check, use any method to check for if the player’s ID or rank of a group is high enough to bypass the check from killing.

If none of the checks passed, they will be ultimately obliterated by the door.

1 Like

the door is working very good, but i only want a few additional lines for bypassing for admins

The idea is to write a table with specific UserIDs of each admin you want to add and then proceed to using table.find(). If it returns nil, it’s not there. Otherwise you can use return to stop the line.

could you send the script? i dont understand very much im not a native english speaker

Do you have a value for the owner script?

what a value? the owner from the tycoon is in a value yes. And this is written in the script

A value in replicated storage.