Cookie Tech Tutorial - How to make a key card door

Have any issues with scripting?


Make a topic in #scripting-support for help!

Source code


Door Manager:

local TweenService = game:GetService("TweenService")

local Debounce  = false
local TimeUntilDoorCloses = 1.5
local Door = script.Parent

Door.Touched:Connect(function(Touched)
	if Touched.Parent.Name == "Keycard" and Debounce == false then
		Debounce = true
		TweenService:Create(Door, TweenInfo.new(0.3), {Transparency=1}):Play()
		Door.CanCollide = false
		wait(TimeUntilDoorCloses)
		TweenService:Create(Door, TweenInfo.new(0.3), {Transparency=0}):Play()
		Door.CanCollide = true
		Debounce = false
	end
end)

Key card Giver:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Tools = ReplicatedStorage:WaitForChild("Tools")

local GroupID = 0
local MinRank = 0



game.Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(GroupID) >= MinRank then
		local ClonedTool = Tools.Keycard:Clone()
		ClonedTool.Parent = Player.Backpack
	end
end)

Downloads


Key card: Keycard.rbxm (2.8 KB)

1 Like

This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.