#Making A Door Respond to Just One Player/User

1 messages · Page 1 of 1 (latest)

safe isle
#

i want to make a door that only responds when a certain player/user interacts with it. (its not a click door its a interaction one)

#

i already have the model/script that makes it open

#

but i dont know how to limit it for only one person to be able to do it

candid dome
#

Wait so you want it to be client sided?

candid dome
safe isle
lyric nexus
#

just add a gaurd clause

candid dome
#

Like if you make a normal door script it should open for everyone if one player opens it

lyric nexus
#

is it only 1 player that can open it?

#

like total

#

?

safe isle
lyric nexus
safe isle
lyric nexus
#

send the code rq i got u

safe isle
#

code?

lyric nexus
#

oh have u not made any?

safe isle
#

script

lyric nexus
#

welll youd basically just add whats call "Guard Clause"

#
if player.Name ~= "ThisName" then return end
safe isle
#

how do i send it

#

its not allowing me to send it

lyric nexus
#

too big?

safe isle
#

no word limits

lyric nexus
#

only send the part about the door

safe isle
#

yea thats what i did

lyric nexus
#

okay so

#

is there a function called like

#

openDoor()

safe isle
#

like im pressing enter

lyric nexus
#

or anything?

safe isle
#

uhh

lyric nexus
#

it would look like

#
local function somethingAboutOpeningADoor()

--code

end
safe isle
#

nah theres no function

lyric nexus
#

oh dear 😭

safe isle
#

there is

#

open goal

#

goalOpen

lyric nexus
#

send that function

safe isle
#

local goalOpen = {}

#

theres no function

lyric nexus
#

oh a table

#

does this script control multiple doors?

safe isle
#

local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)

local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)

candid dome
safe isle
#

local TweenService = game:GetService("TweenService")

local hinge = script.Parent.PrimaryPart
local prompt = script.Parent.Base:FindFirstChildOfClass("ProximityPrompt")
local Sound = nil

if script.Parent.Base:FindFirstChildOfClass("Sound") then
Sound = script.Parent.Base:FindFirstChildOfClass("Sound")
end

local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)

local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)

local tweenInfo = TweenInfo.new(1)
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)

prompt.Triggered:Connect(function()
prompt.Enabled = false
if prompt.ActionText == "Close" then
tweenClose:Play()
prompt.ActionText = "Open"
else
tweenOpen:Play()
prompt.ActionText = "Close"
end
if Sound ~= nil then Sound:Play() end
wait(1)
prompt.Enabled = true
end)

lyric nexus
safe isle
#

this is the whole code

#

i didnt make this btw

#

i used a video 😭

lyric nexus
#

a blue one

safe isle
lyric nexus
#

ok

#

what name?

#

can open it

safe isle
#

its just called Script

lyric nexus
#

u said u want someone to be able to open it

#

who?

#

what username

safe isle
#

Error_Code987654321

lyric nexus
#
prompt.Triggered:Connect(function(playerWhoTriggered)
    if playerWhoTriggered.Name ~= "Error_Code987654321" then return end
    prompt.Enabled = false
    if prompt.ActionText == "Close" then
        tweenClose:Play()
        prompt.ActionText = "Open"
    else
        tweenOpen:Play()
        prompt.ActionText = "Close"
    end
    if Sound ~= nil then Sound:Play() end
    wait(1)
    prompt.Enabled = true
end)
#

FYI

#

if that player opens the door

#

other ppl can still walk in

safe isle
#

yea thats fine

#

where should i insert the script?

lyric nexus
#
local TweenService = game:GetService("TweenService")

local hinge = script.Parent.PrimaryPart
local prompt = script.Parent.Base:FindFirstChildOfClass("ProximityPrompt")
local Sound = nil

if script.Parent.Base:FindFirstChildOfClass("Sound") then
    Sound = script.Parent.Base:FindFirstChildOfClass("Sound")
end

local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)

local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)

local tweenInfo = TweenInfo.new(1)
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)

prompt.Triggered:Connect(function(playerWhoTriggered)
    if playerWhoTriggered.Name ~= "Error_Code987654321" then return end
    prompt.Enabled = false
    if prompt.ActionText == "Close" then
        tweenClose:Play()
        prompt.ActionText = "Open"
    else
        tweenOpen:Play()
        prompt.ActionText = "Close"
    end
    if Sound ~= nil then Sound:Play() end
    wait(1)
    prompt.Enabled = true
end)
safe isle
#

kk

#

tysm

lyric nexus
#

np

#

lmk if it errors

#

it shouldnt

safe isle
#

kk

lyric nexus
#

work?

safe isle
safe isle
lyric nexus
#

would each friend get a dif door?

safe isle
lyric nexus
#

okay

#

make the name of the promt

safe isle
#

just replace that name?

lyric nexus
#

the playes name

safe isle
lyric nexus
#

and ima amke this 1 script work for infinite doors

#

rq

#

@safe isle

#

can u add me to studio?

safe isle
#

?

lyric nexus
#

friend me rq

#

toxicme54e

safe isle
#

hol on wait

safe isle
#

afl sry

#

afk

lyric nexus
safe isle
#

srry

#

mb nigel

#

i meant to ping cain

lyric nexus
#

😭

safe isle
#

anyways

lyric nexus
#

add me to team create

safe isle
#

i added u

lyric nexus
#

i friended u back

hollow scaffold
#

This is funny

lyric nexus
safe isle
#

its under development

lyric nexus
#

@safe isle store yor scripts on the server 🙏

safe isle
#

i cant tell where scripts go

lyric nexus
#

@safe isle

#

ok so

#

open studio chat rq

safe isle
lyric nexus
#

shit i cant find it either lol

safe isle
#

yea they removed it

#

i forgot

#

they thought it was useless

#

because most ppl use discord

lyric nexus
#

ill explain it here

#

so yk where the proximity promts are?

safe isle
lyric nexus
#

make the names of those, the player that can open the door

safe isle
#

like in explorer?

#

kk

#

done

lyric nexus
#

k 1 more min

safe isle
#

since you put the script in server script service

#

primary part had an error

lyric nexus
#

@safe isle

#

done

lyric nexus
#

now all u have to do is add a new door and change the prompt name

lyric nexus
#

@safe isle make yourself a door and test it

lyric nexus
#

worked for me?

#

@safe isle

safe isle
#

oh

#

so every door i make

lyric nexus
#

goes inside the doors model

safe isle
#

has to be put into there?

lyric nexus
#

yes

safe isle
#

kk

#

ty!

lyric nexus
#

ofc!

#

my only request:

#

make me a door fr 😎

#

when the game is done i wanna see it

safe isle
lyric nexus
#

friend me on dc rq so u can ask for help anytime @safe isle