Hi I am making a safe with this script
local code = tostring(math.random(0, 5))
local door = workspace:WaitForChild("Safe").Parts.Hinge.Door
local hinge = workspace:WaitForChild("Safe").Parts.Hinge
local buttons = workspace:WaitForChild("Safe").Buttons
local display = workspace:WaitForChild("Safe").Display.DisplayPart.SurfaceGui
local currentInput = ""
local ts = game:GetService("TweenService")
local info = TweenInfo.new(1.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
local open = ts:Create(hinge, info, {CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(-120), 0)})
for i, v in pairs(buttons:GetChildren()) do
v.ClickDetector.MouseClick:Connect(function()
local buttonInput = v.SurfaceGui.TextLabel.Text
if string.lower(buttonInput) == "+" then
if currentInput == code then
display.TextLabel.TextColor3 = Color3.new(0.3, 1, 0)
display.TextLabel.Text = "Correct"
open:Play()
wait(1)
currentInput = ""
display.TextLabel.TextColor3 = Color3.new(1, 1, 1)
display.TextLabel.Text = "Code..."
elseif currentInput ~= code then
display.TextLabel.TextColor3 = Color3.new(1, 0, 0.01)
display.TextLabel.Text = "Incorrect"
currentInput = ""
wait(1)
display.TextLabel.TextColor3 = Color3.new(1, 1, 1)
display.TextLabel.Text = "Code..."
end
elseif string.lower(buttonInput) == "-" then
currentInput = ""
display.TextLabel.TextColor3 = Color3.new(1, 1, 1)
display.TextLabel.Text = "Code..."
else
currentInput = currentInput..buttonInput
display.TextLabel.Text = currentInput
end
end)
end
Unfortunately I had this problem where I can still write after the result how can I fix this ?