#Owner door

11 messages · Page 1 of 1 (latest)

vast linden
#

You would first need to detect if a player touches the door, after that you would need to check if the tycoon is alr owned or not, if not then set the player of that tycoon to the player (could be the name, character or player, although I recommend setting the player object). That is the claiming part, after that you could set a textlabel in there to the name of the player as an example

#
local Players = game:GetService("Players") --gets the player service (same as game.Players)

local TouchPart = script.Parent.TouchPart --this is the part that needs to be touched to claim ownership
local Owner = script.Parent.Owner --this is an objectValue inside the Door

TouchPart.Touched:Connect(function(hit) --"hit" is the part that touched the door
    local Player = Players:GetPlayerFromCharacter(hit.Parent) --checks if the parent of the part is a character of a player
    if Player and not Owner.Value then --checks if a player touched the door AND if there is no current owner already
        Owner.Value = Player
    end
end)
``` ofc you would  still need to implement something like a check  to prevent players from  claiming multiple tycoons, also this just gives you an idea, I am not saying this is the exact code you should use
#

also, you would need to unclaim the door when the player leaves

arctic needleBOT
#

studio** You are now Level 3! **studio

vast linden
#

if you have further questions feel free to ask ofc

delicate tiger
vast linden
#

a different player could just claim YOUR tycoon

#

also, your script would run evey time ANYTHING touches the door, like let's say a part touches the door, it would quickly set the name of all players to the parent, because you connected the same event multiple times

delicate tiger
vast linden
#

well but that is just not the way to do it 🤷