Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My door doesn't work when I playtest it. What happened?

Asked by 2 years ago
Edited 2 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

I was working on an SCP Door Script and when I followed the whole video's script it didn't work I checked for script errors but theres none I double checked the script and still doesn't work. My suspicion is that I probably messed a name in the parts but when I renamed it to what the video did it still did not work. Do you guys have any help?

Script:

``local TweenService = game:GetService("TweenService")

local Door1 = script.Parent.Door1 local Door2 = script.Parent.Door2

local opentime = 1.3 local closetime = 1.3

local Denied1 = script.Parent.CardReader.Scanner.Denied local Denied2 = script.Parent.CardReader2.Scanner.Denied local Granted1 = script.Parent.CardReader1.Scanner.Granted local Granted2 = script.Parent.CardReader2.Scanner.Granted

local opened = false local debounce = false

local clearance = { ["[SCP] Card - L-0/CDC"] = false, ["[SCP] Card-L1"] = true, ["[SCP] Card-L2"] = true, ["[SCP] Card-L3"] = true, ["[SCP] Card-L4"] = true, ["[SCP] Card-L5"] = true, ["[SCP] Card-Omni"] = true, ["[SCP] Card - Alpha Warhead"] = false, }

Settings = { Tweening = { openinfo = TweenInfo.new(opentime,Enum.EasingStyle.Quart,Enum.EasingDirection.InOut), closeinfo = TweenInfo.new(closetime,Enum.EasingStyle.Quart,Enum.EasingDirection.InOut), DoorClose = {CFrame = Door1.CFrame}, DoorOpen = {CFrame = Door1.CFrame} * CFrame.new (-1.3,1.3,0)}, DoorClose = {CFrame = Door2.CFrame}, DoorOpen = {CFrame = Door2.CFrame} * CFrame.new (-1.3,1.3,0)}

local Door1Close = TweenService:Create(Door1,Settings.Tweening.closeinfo,Settings.Tweening.Door1Close) local Door2Close = TweenService:Create(Door2,Settings.Tweening.closeinfo,Settings.Tweening.Door2Close) local Door1Open = TweenService:Create(Door1,Settings.Tweening.openinfo,Settings.Tweening.Door1Close) local Door2Open = TweenService:Create(Door2,Settings.Tweening.openinfo,Settings.Tweening.Door2Close)

function OpenDoor() Door1Open:Play() Door2Open:Play() end

function CloseDoor() Door1Close:Play() Door2Close:Play() end

script.Parent.CardReader.Scanner.Touched:Connect(function(touch) if touch.name == "Handle" and clearance[touch.Parent.Name] then if not debounce and not opened then debounce = true Granted1:Play() wait (0.5) OpenDoor() opened = true debounce = false wait (3) end elseif touch.name == "Handle" and not clearance[touch.Parent.Name] then Denied1:Play() wait (0.5) wait (3) end end)

script.Parent.CardReader.Scanner.Touched:Connect(function(touch) if touch.name == "Handle" and clearance[touch.Parent.Name] then if not debounce and opened then debounce = true Granted1:Play() wait (0.5) CloseDoor() opened = false debounce = false wait (3) end elseif touch.name == "Handle" and not clearance[touch.Parent.Name] then Denied1:Play() wait (0.5) wait (3) end end)

script.Parent.CardReader.Scanner.Touched:Connect(function(touch) if touch.name == "Handle" and clearance[touch.Parent.Name] then if not debounce and not opened then debounce = true Granted2:Play() wait (0.5) OpenDoor() opened = true debounce = false wait (3) end elseif touch.name == "Handle" and not clearance[touch.Parent.Name] then Denied2:Play() wait (0.5) wait (3) end end)

script.Parent.CardReader.Scanner.Touched:Connect(function(touch) if touch.name == "Handle" and clearance[touch.Parent.Name] then debounce = true Granted2:Play() if not debounce and opened then wait (0.5) CloseDoor() opened = false debounce = false wait (3) end elseif touch.name == "Handle" and not clearance[touch.Parent.Name] then Denied2:Play() wait (0.5) wait (3) end end)``

0
Please format your code correctly Sabailuridze 126 — 2y

Answer this question