@roblox_user_54556995 script uses that value…
I think im misunderstanding completely
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.
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.
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
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 i thought its not hard
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)
i can run trough but other players too
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:
NOTE: this answer is almost exactly the same as @anon81993163 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