Advertisement
coderboy

Roblox Code

May 14th, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. --define variables
  2. local time = 0
  3. local speed
  4. local T = false
  5. --functions, and other events
  6. function Igate(state)
  7.     if state then
  8.         workspace.C.CanCollide = true
  9.         print("Locked")
  10.     Else
  11.         workspace.C.CanCollide = false
  12.     End
  13. End
  14. script.Parent.B.Touched:Connect(function(
  15.     T = true
  16.     Igate(true)
  17. )end
  18. script.Parent.B.Touched:Connect(function(
  19.     T = false
  20.     Igate(false)
  21.     Calculate()
  22. )end
  23. while true do
  24.     while T do
  25.         wait(1)
  26.         time = time + 1
  27.     end
  28. end
  29.  
  30. function Calculate()
  31.     speed = time / --distance
  32.     print(speed)
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement