Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do you make 2 different functions?

how do you make 2 different functions, one for if you dont have a keycard and one if you do the keycard name is handle: workspace.keycard.handle

how do i do if u dont have a key card a function happens and if you do the door opens(dont add the actual script for the door just how to do this^^)

would i do

if hit.Parent:FindFirstChild("Handle")=true then --my script

if hit.Parent:FindFirstChild("Handle")=false then --my script

the key card sensor is called Door and the keycard is called Handle

2 comments

0

Not entirely sure what you are trying to ask about functions...

0

If you want to make 2 functions, just make them in 1 script.

1 answer

I'm thinking you are trying to make a Keycard Door. Put script in door and make a tool called "Keycard".


local time = 3 -- time the player has before door closes
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Keycard") then
	-- player has to be holding a tool called "Keycard"
	-- the handle for any tool is called "Handle"
	-- and so it is better if you get the tool name
	-- make sure it is called keycard
		script.Parent.CanCollide = false
		script.Parent.Transparency = 0.5
		-- changes properties so play can go through
		wait(time) -- waits value of time
		script.Parent.CanCollide = true
		script.Parent.Transparency = 0
	elseif not hit.Parent:FindFirstChild("Keycard") and hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent:BreakJoints()
	end
end)

3 comments

0

doesnt work

0

it doesnt break joints

0

idk i think it was a glitch

This discussion is preserved as it was. New answers, comments, and votes are closed.