Advertisement
BladGoKop

roblox studio ep17 สอนสร้างPaswordDoor

Mar 20th, 2023
1,155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. local A = "1111"--ด้านใน""คือรหัสผ่านที่ถูกต้องซึ่งสามารถเปลี่ยนได้
  2. local B = ""
  3. for i, v in pairs(script.Parent.PadGroup:GetChildren()) do
  4.     v.ClickDetector.MouseClick:Connect(function()
  5.         B = B..v.Name
  6.         script.Parent.Screen.SurfaceGui.TextLabel.Text = B
  7. -----  ส่วนตรงนี้เป็นการเปลี่ยนสีPartที่เป็นปุ่ม
  8.         v.BrickColor = BrickColor.new("Bright green")
  9.         wait(0.15)
  10.         v.BrickColor = BrickColor.new("Fossil")
  11. -----------------------------------------------------------------
  12.     end)
  13. end
  14. script.Parent.ResetButton.ClickDetector.MouseClick:Connect(function()
  15.     B = ""
  16.     script.Parent.Screen.SurfaceGui.TextLabel.Text = B
  17. end)
  18. script.Parent.EnterButton.ClickDetector.MouseClick:Connect(function()
  19.     if B == A then
  20. ----ส่วนตรงนี้เป็นส่วนที่จะทำให้ประตูมันเปิด(สามารถตัดส่วนนี้ออกแล้วเปลี่ยนเป็นอย่างอื่นที่ไม่ใช่การเปิดประตูแทนก็ได้)
  21.         script.Parent.Door.Transparency = 1
  22.         script.Parent.Door.CanCollide = false
  23.         print("True")
  24.         script.Parent.Screen.BrickColor = BrickColor.new("Bright green")
  25.         wait(1.5)
  26.         script.Parent.Screen.BrickColor = BrickColor.new("Fossil")
  27. -----------------------------------------------------------------
  28.     else
  29.         print("False")
  30.     end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement