Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make an owner door? (Not for a tycoon)

Asked by 4 years ago

I cant figure out how to make an owner door for a house. Im trying to make a door for a house like For Example, Pacifco 2 does. Im making a** RP game and im stuck at the door script. Hope you can help me. :D

0
Im new at making games and using this site so sorry if im doing anything wrong. 12tytsi 0 — 4y
0
I think you can make a IntValue inside the door to store UserID. When someone touch the door, check the value. If the value don't have any value(mean there is no owner), copy the UserID of the player into it and set the owner to the player. Else, if the value has value (mean there is a owner), the player can't go though the door. Block_manvn 395 — 4y
0
ScriptingHelper sis NOT a request site, We don't give you scripts. I suggest you look at the Roblox Dev hub https://developer.roblox.com/en-us/learn-roblox/all-tutorials and learn how to Script Luka_Gaming07 534 — 4y
0
@12tytsi You kinda sound like you have a script. Why not add it to your question? It'll be easier that way. Cyroxite 46 — 4y
0
I did have a script but i could not get the system to work how i wanted it to work. 12tytsi 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Alright, this is how to make an owner only door. If anyone else comes, the door will kill them, and this can be toggled.

Sorry if there are some errors with the code, I'm not too good at it. Also note that the pathway for the variables are just examples (noted by "example")

First, let's put a value for the code to identify who should be allowed. This can be done at the start when a player claims a tycoon.

local value= workspace.GreenTycoon.UserIdValue --Example
local door= workspace.GreenTycoon.Door --Example

door.Touched:Connect(function(hit)
    local hitParent= hit.Parent
    local humanoid= hitParent:FindFirstChild("Humanoid")
if humanoid then
    local player= game.Players:GetPlayerFromCharacter(hitParent)
    value.Value= Player.UserId
        --The rest of the code you're going to put when a player claims it.
end
end

Next, when the owner only door is purchased, with the lasers and switch, let's add this code to let only the owner throught based on the switch.

local tycoon= workspace.GreenTycoon --Example
local toggle=  tycoon.Toggle --Example --Example
local laser= tycoon.laser -Example --Example
local value= workspace.GreenTycoon.UserIdValue --Example
local newValue= instance.new("BoolValue, toggle) --Example
newValue.Value= true

laser.Touched:Connect(function(hit))
    local hitParent= hit.Parent
    local humanoid= hitParent:FindFirstChild("Humanoid")
        if humanoid then
        local player= game.Players:GetPlayerFromCharacter(hitParent)
    if player.UserId != value.Value then
        if newValue= true then
            humanoid.Health= 0
        else
        print("A person touched the laser, but he or she is allowed to go!")
    end
end
end
end

You might need to look at it a little bit to understand it, but this is how I would put it.

0
Thanks, but the system i was trying to make was not that other players get killed when they try going through the door. But just can’t go through the door. Its also on the title. But i fell really bad that you did all this. Even if i use this site wrong you help so thanks man :D 12tytsi 0 — 4y
0
Im late but you can research about collision groups if that helps Cyroxite 46 — 3y
Ad

Answer this question