Advertisement
Ubicast

Time (Day/Night) Changer Script | ROBLOX

Nov 21st, 2020
2,721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local Humanoid = script.Parent:FindFirstChild("Humanoid")
  2. local UserInputService = game:GetService("UserInputService")
  3. local Key = Enum.KeyCode.T
  4. local Lighting = game.Lighting
  5. local Step = 0.1
  6. local TweenWaitTime = 0.05
  7. local Holding = false
  8.  
  9. local TweenService = game:GetService("TweenService")
  10. local MyTweenInfo = TweenInfo.new(TweenWaitTime, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
  11. local ChangeTime_Properties = {ClockTime = Lighting.ClockTime + Step}
  12.  
  13. local ChangeTime_TweenAnimation = TweenService:Create(Lighting, MyTweenInfo, ChangeTime_Properties)
  14.  
  15. UserInputService.InputBegan:Connect(function(Input)
  16.     if Input.KeyCode == Key then
  17.         Holding = true
  18.        
  19.         while Holding == true and wait() do
  20.             ChangeTime_Properties = {ClockTime = Lighting.ClockTime + Step}
  21.             ChangeTime_TweenAnimation = TweenService:Create(Lighting, MyTweenInfo, ChangeTime_Properties)
  22.             ChangeTime_TweenAnimation:Play()
  23.         end
  24.     end
  25. end)
  26.  
  27. UserInputService.InputEnded:Connect(function(Input)
  28.     if Input.KeyCode == Key then
  29.         Holding = false
  30.     end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement