-
What do you want to achieve?
so i was making a random password door
-
What is the issue?
i don’t know why but my randomly generated passcode doesn’t work for my pass door ,
see the script below .Scripts Below
local Door1 = script.Parent.DoorPart1
local Door2 = script.Parent.DoorPart2
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(1.8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local DoorOpenPosition1 = script.Parent.OpenPosition1
local DoorOpenPosition2 = script.Parent.OpenPosition2
local DoorClosePosition1 = script.Parent.ClosedPosition1
local DoorClosePosition2 = script.Parent.ClosedPosition2
local DoorOpenTween1 = TweenService:Create(Door1, Info,{CFrame = DoorOpenPosition1.CFrame})
local DoorOpenTween2 = TweenService:Create(Door2, Info,{CFrame = DoorOpenPosition2.CFrame})
local DoorCloseTween1 = TweenService:Create(Door1, Info, {CFrame = DoorClosePosition1.CFrame})
local DoorCloseTween2 = TweenService:Create(Door2, Info, {CFrame = DoorClosePosition2.CFrame})
local Input = script.Parent.KeypadBase.KeypadGui.InputtedCode
local Button = script.Parent.KeypadBase.KeypadGui.ButtonsBG
local Code = game.ReplicatedStorage.MainGameComponents.Values.Password.Value
local CurrentCode = ""
Input.Text = CurrentCode
for i, button in pairs(Button:GetChildren()) do
button.MouseButton1Click:Connect(function()
if tonumber(button.Name) then
CurrentCode = CurrentCode .. button.Name
Input.Text = CurrentCode
elseif button.Name == "Reset" then
CurrentCode = ""
Input.Text = CurrentCode
elseif button.Name == "Enter" then
if CurrentCode == Code then
CurrentCode = ""
Input.Text = "Success"
DoorOpenTween1:Play()
DoorOpenTween2:Play()
else
CurrentCode = ""
Input.Text = "Incorrect code"
end
end
end)
end
--Old Scripts
--script.Parent.DoorPart1.Touched:Connect(function()
--DoorOpenTween1:Play()
--DoorOpenTween2:Play()
--end)
If i can do like that , then i can’t make a randomly generated passcode door … somebody please help me
