altf4foradmin

Keystrokes

Mar 6th, 2022 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.48 KB | None | 0 0
  1. local plr = game:GetService("Players").LocalPlayer
  2. local mouse = plr:GetMouse()
  3. local rs = game:GetService("RunService")
  4. local uis = game:GetService("UserInputService")
  5.  
  6. local function drag(GTD,d_speed)
  7.     spawn(function()
  8.         local gui = GTD
  9.         local dragging
  10.         local dragInput
  11.         local dragStart
  12.         local startPos
  13.         function Lerp(a, b, m)
  14.             return a + (b - a) * m
  15.         end;
  16.         local lastMousePos
  17.         local lastGoalPos
  18.         local DRAG_SPEED = (d_speed);
  19.         function Update(dt)
  20.             if not (startPos) then return end;
  21.             if not (dragging) and (lastGoalPos) then
  22.                 gui.Position = UDim2.new(startPos.X.Scale, Lerp(gui.Position.X.Offset, lastGoalPos.X.Offset, dt * DRAG_SPEED), startPos.Y.Scale, Lerp(gui.Position.Y.Offset, lastGoalPos.Y.Offset, dt * DRAG_SPEED))
  23.                 return
  24.             end;
  25.             local delta = (lastMousePos - uis:GetMouseLocation())
  26.             local xGoal = (startPos.X.Offset - delta.X);
  27.             local yGoal = (startPos.Y.Offset - delta.Y);
  28.             lastGoalPos = UDim2.new(startPos.X.Scale, xGoal, startPos.Y.Scale, yGoal)
  29.             gui.Position = UDim2.new(startPos.X.Scale, Lerp(gui.Position.X.Offset, xGoal, dt * DRAG_SPEED), startPos.Y.Scale, Lerp(gui.Position.Y.Offset, yGoal, dt * DRAG_SPEED))
  30.         end;
  31.         gui.InputBegan:Connect(function(input)
  32.             if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  33.                 dragging = true
  34.                 dragStart = input.Position
  35.                 startPos = gui.Position
  36.                 lastMousePos = uis:GetMouseLocation()
  37.                 input.Changed:Connect(function()
  38.                     if input.UserInputState == Enum.UserInputState.End then
  39.                         dragging = false
  40.                     end
  41.                 end)
  42.             end
  43.         end)
  44.         gui.InputChanged:Connect(function(input)
  45.             if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  46.                 dragInput = input
  47.             end
  48.         end)
  49.         rs.Heartbeat:Connect(Update)
  50.     end)
  51. end
  52. function rainbow(obj,speed,p)
  53.     local rainbow_speed = speed or 5
  54.     local object = obj or false
  55.     local to = p
  56.     spawn(function()
  57.         while object do
  58.             rs.Stepped:wait()
  59.             object[to] = Color3.fromRGB(255,0,0)
  60.             for i = 0,255,rainbow_speed do
  61.                 wait()
  62.                 object[to] = Color3.fromRGB(255,i,0)
  63.             end
  64.             for i = 255,0,-rainbow_speed do
  65.                 wait()
  66.                 object[to] = Color3.fromRGB(i,255,0)
  67.             end
  68.             for i = 0,255,rainbow_speed do
  69.                 wait()
  70.                 object[to] = Color3.fromRGB(0,255,i)
  71.             end
  72.             for i = 255,0,-rainbow_speed do
  73.                 wait()
  74.                 object[to] = Color3.fromRGB(0,i,255)
  75.             end
  76.             for i = 0,255,rainbow_speed do
  77.                 wait()
  78.                 object[to] = Color3.fromRGB(i,0,255)
  79.             end
  80.             for i = 255,0,-rainbow_speed do
  81.                 wait()
  82.                 object[to] = Color3.fromRGB(255,0,i)
  83.             end
  84.         end
  85.     end)
  86. end
  87.  
  88. local Keystrokes = Instance.new("ScreenGui")
  89. local MainFrame = Instance.new("Frame")
  90. local w = Instance.new("TextLabel")
  91. local UICorner = Instance.new("UICorner")
  92. local s = Instance.new("TextLabel")
  93. local UICorner_2 = Instance.new("UICorner")
  94. local d = Instance.new("TextLabel")
  95. local UICorner_3 = Instance.new("UICorner")
  96. local a = Instance.new("TextLabel")
  97. local UICorner_4 = Instance.new("UICorner")
  98. local mb1 = Instance.new("TextLabel")
  99. local UICorner_5 = Instance.new("UICorner")
  100. local UITextSizeConstraint = Instance.new("UITextSizeConstraint")
  101. local mb2 = Instance.new("TextLabel")
  102. local UICorner_6 = Instance.new("UICorner")
  103. local space = Instance.new("TextLabel")
  104. local UICorner_7 = Instance.new("UICorner")
  105. Keystrokes.Name = "Keystrokes"
  106. Keystrokes.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  107. Keystrokes.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  108. Keystrokes.ResetOnSpawn = false
  109. MainFrame.Name = "MainFrame"
  110. MainFrame.Parent = Keystrokes
  111. MainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  112. MainFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  113. MainFrame.BackgroundTransparency = 1.000
  114. MainFrame.Position = UDim2.new(0.120211348, 0, 0.469785571, 0)
  115. MainFrame.Size = UDim2.new(0.150000003, 0, 0.250000012, 0)
  116. w.Name = "w"
  117. w.Parent = MainFrame
  118. w.AnchorPoint = Vector2.new(0.5, 0.5)
  119. w.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  120. w.BorderSizePixel = 0
  121. w.Position = UDim2.new(0.5, 0, 0.125, 0)
  122. w.Size = UDim2.new(0.25, 0, 0.25, 0)
  123. w.Font = Enum.Font.SourceSans
  124. w.Text = "W"
  125. w.TextColor3 = Color3.fromRGB(255, 255, 255)
  126. w.TextScaled = true
  127. w.TextSize = 14.000
  128. w.TextWrapped = true
  129. UICorner.Parent = w
  130. s.Name = "s"
  131. s.Parent = MainFrame
  132. s.AnchorPoint = Vector2.new(0.5, 0.5)
  133. s.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  134. s.BorderSizePixel = 0
  135. s.Position = UDim2.new(0.5, 0, 0.425000012, 0)
  136. s.Size = UDim2.new(0.25, 0, 0.25, 0)
  137. s.Font = Enum.Font.SourceSans
  138. s.Text = "S"
  139. s.TextColor3 = Color3.fromRGB(255, 255, 255)
  140. s.TextScaled = true
  141. s.TextSize = 14.000
  142. s.TextWrapped = true
  143. UICorner_2.Parent = s
  144. d.Name = "d"
  145. d.Parent = MainFrame
  146. d.AnchorPoint = Vector2.new(0.5, 0.5)
  147. d.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  148. d.BorderSizePixel = 0
  149. d.Position = UDim2.new(0.800000012, 0, 0.425000012, 0)
  150. d.Size = UDim2.new(0.25, 0, 0.25, 0)
  151. d.Font = Enum.Font.SourceSans
  152. d.Text = "D"
  153. d.TextColor3 = Color3.fromRGB(255, 255, 255)
  154. d.TextScaled = true
  155. d.TextSize = 14.000
  156. d.TextWrapped = true
  157. UICorner_3.Parent = d
  158. a.Name = "a"
  159. a.Parent = MainFrame
  160. a.AnchorPoint = Vector2.new(0.5, 0.5)
  161. a.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  162. a.BorderSizePixel = 0
  163. a.Position = UDim2.new(0.200000003, 0, 0.425000012, 0)
  164. a.Size = UDim2.new(0.25, 0, 0.25, 0)
  165. a.Font = Enum.Font.SourceSans
  166. a.Text = "A"
  167. a.TextColor3 = Color3.fromRGB(255, 255, 255)
  168. a.TextScaled = true
  169. a.TextSize = 14.000
  170. a.TextWrapped = true
  171. UICorner_4.Parent = a
  172. mb1.Name = "mb1"
  173. mb1.Parent = MainFrame
  174. mb1.AnchorPoint = Vector2.new(0.5, 0.5)
  175. mb1.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  176. mb1.BorderSizePixel = 0
  177. mb1.Position = UDim2.new(0.273999989, 0, 0.899999976, 0)
  178. mb1.Size = UDim2.new(0.401915461, 0, 0.200000003, 0)
  179. mb1.Font = Enum.Font.SourceSans
  180. mb1.Text = "LMB: 0"
  181. mb1.TextColor3 = Color3.fromRGB(255, 255, 255)
  182. mb1.TextSize = 19.000
  183. mb1.TextWrapped = true
  184. mb1.TextXAlignment = Enum.TextXAlignment.Left
  185. UICorner_5.Parent = mb1
  186. UITextSizeConstraint.Parent = mb1
  187. UITextSizeConstraint.MaxTextSize = 19
  188. mb2.Name = "mb2"
  189. mb2.Parent = MainFrame
  190. mb2.AnchorPoint = Vector2.new(0.5, 0.5)
  191. mb2.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  192. mb2.BorderSizePixel = 0
  193. mb2.Position = UDim2.new(0.721000016, 0, 0.899999976, 0)
  194. mb2.Size = UDim2.new(0.401915431, 0, 0.200000003, 0)
  195. mb2.Font = Enum.Font.SourceSans
  196. mb2.Text = "RMB: 0"
  197. mb2.TextColor3 = Color3.fromRGB(255, 255, 255)
  198. mb2.TextSize = 19.000
  199. mb2.TextWrapped = true
  200. mb2.TextXAlignment = Enum.TextXAlignment.Left
  201. UICorner_6.Parent = mb2
  202. space.Name = "space"
  203. space.Parent = MainFrame
  204. space.AnchorPoint = Vector2.new(0.5, 0.5)
  205. space.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  206. space.BorderSizePixel = 0
  207. space.Position = UDim2.new(0.5, 0, 0.675000012, 0)
  208. space.Size = UDim2.new(0.850000024, 0, 0.150000006, 0)
  209. space.Font = Enum.Font.SourceSans
  210. space.Text = "SPACE"
  211. space.TextColor3 = Color3.fromRGB(255, 255, 255)
  212. space.TextScaled = true
  213. space.TextSize = 14.000
  214. space.TextWrapped = true
  215. UICorner_7.Parent = space
  216.  
  217. drag(MainFrame,8)
  218. mouse.KeyDown:Connect(function(key)
  219.     if key=="w" then
  220.         w.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
  221.     elseif key=="s" then
  222.         s.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
  223.     elseif key=="a" then
  224.         a.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
  225.     elseif key=="d" then
  226.         d.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
  227.     elseif key==" " then
  228.         space.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
  229.     end
  230. end)
  231. mouse.KeyUp:Connect(function(key)
  232.     if key=="w" then
  233.         w.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  234.     elseif key=="s" then
  235.         s.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  236.     elseif key=="a" then
  237.         a.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  238.     elseif key=="d" then
  239.         d.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  240.     elseif key==" " then
  241.         space.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  242.     end
  243. end)
  244. local mb1Clicked = 0
  245. local mb2Clicked = 0
  246. mouse.Button1Down:Connect(function()
  247.     mb1.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
  248.     mb1Clicked = mb1Clicked+1
  249.     spawn(function()
  250.         wait(1)
  251.         mb1Clicked = mb1Clicked-1
  252.     end)
  253. end)
  254. mouse.Button1Up:Connect(function()
  255.     mb1.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  256. end)
  257. mouse.Button2Down:Connect(function()
  258.     mb2.BackgroundColor3 = Color3.fromRGB(79, 79, 79)
  259.     mb2Clicked = mb2Clicked+1
  260.     spawn(function()
  261.         wait(1)
  262.         mb2Clicked = mb2Clicked-1
  263.     end)
  264. end)
  265. mouse.Button2Up:Connect(function()
  266.     mb2.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
  267. end)
  268.  
  269. rainbow(w,10,"TextColor3")
  270. rainbow(s,10,"TextColor3")
  271. rainbow(a,10,"TextColor3")
  272. rainbow(d,10,"TextColor3")
  273. rainbow(space,10,"TextColor3")
  274. rainbow(mb1,10,"TextColor3")
  275. rainbow(mb2,10,"TextColor3")
  276.  
  277. spawn(function()
  278.     while true do rs.Stepped:wait()
  279.         mb1.Text = "LMB: "..mb1Clicked
  280.         mb2.Text = "RMB: "..mb2Clicked
  281.     end
  282. end)
  283.  
Advertisement
Add Comment
Please, Sign In to add comment