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 5 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 — 5y
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 — 5y
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 — 5y
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 — 5y
0
I did have a script but i could not get the system to work how i wanted it to work. 12tytsi 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 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.

01local value= workspace.GreenTycoon.UserIdValue --Example
02local door= workspace.GreenTycoon.Door --Example
03 
04door.Touched:Connect(function(hit)
05    local hitParent= hit.Parent
06    local humanoid= hitParent:FindFirstChild("Humanoid")
07if humanoid then
08    local player= game.Players:GetPlayerFromCharacter(hitParent)
09    value.Value= Player.UserId
10        --The rest of the code you're going to put when a player claims it.
11end
12end

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.

01local tycoon= workspace.GreenTycoon --Example
02local toggle=  tycoon.Toggle --Example --Example
03local laser= tycoon.laser -Example --Example
04local value= workspace.GreenTycoon.UserIdValue --Example
05local newValue= instance.new("BoolValue, toggle) --Example
06newValue.Value= true
07 
08laser.Touched:Connect(function(hit))
09    local hitParent= hit.Parent
10    local humanoid= hitParent:FindFirstChild("Humanoid")
11        if humanoid then
12        local player= game.Players:GetPlayerFromCharacter(hitParent)
13    if player.UserId != value.Value then
14        if newValue= true then
15            humanoid.Health= 0
View all 21 lines...

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 — 5y
0
Im late but you can research about collision groups if that helps Cyroxite 46 — 4y
Ad

Answer this question