I have been searching everywhere and I cannot find a good way to make one. Please help.
Make a class for all the doors. Then bind the main door function to all the doors in the game using CollectionService.
To make the doors move use TweenService.
If you’re going to use an interact type keycard and not by touching the keycard inserter, then
add a proximity prompt. Once interacted with check the player who interacted with it has a keycard in their inventory. If they do, use tweenservice to open the doors.
I forgot to say I ain’t a good scripter and I kind of don’t understand some things.
A proximity prompt is an object you can insert into a part. It is basically a interact GUI.
proximityprompt.Trigger:Connect(function(playerwhotriggered)
The trigger event checks if the interaction with the GUI is fully complete. Then a value is passed on
that holds the player who triggered the proximity prompt.
An if statement is basic, but if you don’t know it then you should probably research some more. Loop through the players backpack or character just in case, use an if statement to check if theres a keycard in the inventory, if there is use tweeenservice. Tweenservice is used to smoothly move things. Advanced Roblox Scripting Tutorial #10 - TweenService / Tween (Beginner to Pro 2019) - YouTube Tweenservice tutorial.
Thanks! that video helped a lot on tweening.
May you show me how to “check the player who interacted with it has a keycard in their inventory”?
Well, you shouldn’t ask people to make scripts for you but sure:
local proximityprompt = -- Your prox prompt
local KeyCard = -- Your keycard
proximityprompt.Trigger:Connect(function(playerwhotriggered)
for i, v in pairs(playerwhotriggered:WaitForChild("Backpack")) do
if v.Name == KeyCard.Name then
end
end
end)
Thank you! Also sorry I didn’t know I wasn’t supposed to ask that.
It’s okay, its in the scripting support rules:
you can also do
local keycard = player.Backpack:FindFirstChild("keycard")
if keycard then
-- open the door
end
Thoughts about using Constraints instead of TweenService?
I’ve been around the genre quite a bit so I can say for certain that TweenService is the most popular to use and it’s probably easier as well but at the end of the day it’s whatever floats your boat.
Well I have found my solution. Thanks for all of the advice.
Yes, this may work but I do not know.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.