How to make a Admin Bypass for this door?

Did you create it in the script, like if they touch to the door then the value is created?

if they touch the door you are in a team and the owner value in the tycoon kit is then in example “ByGoalZ”

Script line:
if part.Parent.Name ~= script.Parent.Parent.Parent.Parent.Parent.Owner.Value.Character.Name then
There you can see

Wait I know the problem, you put your ID.

Wait what, you are confusing me can you explain more.

Is it a free model tycoon? If it is, you should consider making you’re own by learning to script the hard way. It’s worth it!

its a tycoon kit yes, but big games like tropical resort tycoon, airport tycoon use that kit too :slight_smile:
But i built all by myself. And i make 10k robux per month with this game so i think its not sooo bad. But i only want a admin bypass for this door :smiley: i thought its not hard

2 Likes

Do not rely on this to a full extent. This is almost a band-aid solution as it can be bad practice if applied incorrectly.

local ownerID = 1240678162
local adminList = {} -- include UserId(s) of admins

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 table.find(adminList, plr.UserId) then
					return
				end
				
				if part.Parent.Name ~= script.Parent.Parent.Parent.Parent.Parent.Owner.Value.Character.Name then
					h.Health = 0
				elseif plr.UserId == ownerID then
					part.Parent:FindFirstChild("Humanoid").Health = 100
				end
			end
		end
	end
end
script.Parent.Touched:connect(touc)
1 Like

i can run trough but other players too :confused:

only the tycoon owner and me should be able to run trough

I think the issue is that we cannot see the other scripts. Could you show the script that stores the value for the tycoon owner?

Try this, the OwnerID should be the Tycoon Owner UserID and the admins ids are used for people you want to exempt to all doors e.g. you

local Players = game:GetService("Players")

local ownerID = 1240678162 --Tycoon Owner ID
local adminIDTable = {395435632, 328771631} --ID's for admins, Could put this in a module

function doorTouched(hit)
	
	local plr = Players:GetPlayerFromCharacter(hit.Parent)
	local plrHumanoid = hit.Parent:FindFirstChild("Humanoid")
	
	if plrHumanoid and plr then --Humanoid And Player Found
		
		if val.Value == true then --Still dont know what this is
			
			--Checking if player is admin
			if table.find(adminIDTable, plr.UserId) then
				print("Player Is Admin: Allowing them through!")
				return
			end
			
			--Checking if player is tycoon owner or not
			if plr.UserId == ownerID then --Player is Owner
				plrHumanoid.Health = 100
				print("Player is allowed through: Setting health to 100!")
			else --Player is not Owner
				plrHumanoid.Health = 0
				print("Player is not allowed through: Killing player!")
			end
			
		end
	end
end

script.Parent.Touched:connect(doorTouched)

EDITS YOU COULD MAKE:

  1. Store the UserId for the tycoon owner in the door as a IntValue
  2. Make a module script to handle admin / owner IDs, this could be required by all doors preventing data duplication

NOTE: this answer is almost exactly the same as @Operatik so if this works pls give the solution to him.

i fixed it with a help of a other scripter but thanks for your help

1 Like