Advertisement
Infintyboy

T O D D

Aug 31st, 2018
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.11 KB | None | 0 0
  1. --TODO: add comments or something idk
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player = owner
  4. local Mouse,mouse,UserInputService,ContextActionService
  5. do
  6.     script.Parent = Player.Character
  7.     local CAS = {Actions={}}
  8.     local Event = Instance.new("RemoteEvent")
  9.     Event.Name = "UserInput_Event"
  10.     Event.Parent = Player.Character
  11.     local fakeEvent = function()
  12.         local t = {_fakeEvent=true}
  13.         t.Connect = function(self,f)self.Function=f end
  14.         t.connect = t.Connect
  15.         return t
  16.     end
  17.     local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  18.     local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  19.     function CAS:BindAction(name,fun,touch,...)
  20.         CAS.Actions[name] = {Name=name,Function=fun,Keys={...}}
  21.     end
  22.     function CAS:UnbindAction(name)
  23.         CAS.Actions[name] = nil
  24.     end
  25.     local function te(self,ev,...)
  26.         local t = m[ev]
  27.         if t and t._fakeEvent and t.Function then
  28.             t.Function(...)
  29.         end
  30.     end
  31.     m.TrigEvent = te
  32.     UIS.TrigEvent = te
  33.     Event.OnServerEvent:Connect(function(plr,io)
  34.         if plr~=Player then return end
  35.         if io.isMouse then
  36.             m.Target = io.Target
  37.             m.Hit = io.Hit
  38.         elseif io.UserInputType == Enum.UserInputType.MouseButton1 then
  39.             if io.UserInputState == Enum.UserInputState.Begin then
  40.                 m:TrigEvent("Button1Down")
  41.             else
  42.                 m:TrigEvent("Button1Up")
  43.             end
  44.         else
  45.             for n,t in pairs(CAS.Actions) do
  46.                 for _,k in pairs(t.Keys) do
  47.                     if k==io.KeyCode then
  48.                         t.Function(t.Name,io.UserInputState,io)
  49.                     end
  50.                 end
  51.             end
  52.             if io.UserInputState == Enum.UserInputState.Begin then
  53.                 m:TrigEvent("KeyDown",io.KeyCode.Name:lower())
  54.                 UIS:TrigEvent("InputBegan",io,false)
  55.             else
  56.                 m:TrigEvent("KeyUp",io.KeyCode.Name:lower())
  57.                 UIS:TrigEvent("InputEnded",io,false)
  58.             end
  59.         end
  60.     end)
  61.     NLS([==[
  62.     local Player = game:GetService("Players").LocalPlayer
  63.    
  64.     local Char = Player.Character
  65.     local Event = Char:WaitForChild("UserInput_Event")
  66.    
  67.     local UIS = game:GetService("UserInputService")
  68.    
  69.     local input = function(io,a)
  70.         if a then return end
  71.         local io = {KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState}
  72.         Event:FireServer(io)
  73.     end
  74.     UIS.InputBegan:Connect(input)
  75.     UIS.InputEnded:Connect(input)
  76.     local Changed = false
  77.     local Mouse = Player:GetMouse()
  78.     local mouse = Player:GetMouse()
  79.     local h,t = Mouse.Hit,Mouse.Target
  80.     while wait(1/30) do
  81.         if h~=Mouse.Hit or t~=Mouse.Target then
  82.             Event:FireServer({isMouse=true,Target=Mouse.Target,Hit=Mouse.Hit})
  83.             h,t=Mouse.Hit,Mouse.Target
  84.         end
  85.     end
  86.     ]==],Player.Character)
  87.     Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  88. end
  89. ---
  90.  
  91. Player = owner
  92. PlayerGui = Player.PlayerGui
  93. Cam = workspace.CurrentCamera
  94. Backpack = Player.Backpack
  95. Character = Player.Character
  96. Humanoid = Character.Humanoid
  97.  
  98. wait(0.2)
  99.  
  100.  
  101. --[[
  102.         Thanks for using Build-To-Lua by jarredbcv.
  103. ]]--
  104.  
  105. New = function(Object, Parent, Name, Data)
  106.     local Object = Instance.new(Object)
  107.     for Index, Value in pairs(Data or {}) do
  108.         Object[Index] = Value
  109.     end
  110.     Object.Parent = Parent
  111.     Object.Name = Name
  112.     return Object
  113. end
  114.    
  115. Char = New("Part",Workspace,"Char",{BrickColor = BrickColor.new("Alder"),Material = Enum.Material.SmoothPlastic,Size = Vector3.new(3.96000004, 3.8199985, 4.09999466),CFrame = CFrame.new(-6.14301682, 1.91000998, -11.4384756, 1, 0, 0, 0, 1, 0, 0, 0, 1),BottomSurface = Enum.SurfaceType.Smooth,TopSurface = Enum.SurfaceType.Smooth,Color = Color3.new(0.705882, 0.501961, 1),})
  116. Decal = New("Decal",Char,"Decal",{Face = Enum.NormalId.Back,Texture = "rbxassetid://802372527",})
  117. Mesh = New("SpecialMesh",Char,"Mesh",{MeshType = Enum.MeshType.Sphere,})
  118. BodyForce = New("BodyForce",Char,"BodyForce",{})
  119.  
  120. wait()
  121.  
  122. function sandbox(var,func)
  123.     local env = getfenv(func)
  124.     local newenv = setmetatable({},{
  125.         __index = function(self,k)
  126.             if k=="script" then
  127.                 return var
  128.             else
  129.                 return env[k]
  130.             end
  131.         end,
  132.     })
  133.     setfenv(func,newenv)
  134.     return func
  135. end
  136. cors = {}
  137. mas = Instance.new("Model",game:GetService("Lighting"))
  138. StarterPlayerScripts0 = Instance.new("StarterPlayerScripts")
  139. LocalScript1 = Instance.new("LocalScript")
  140. StarterCharacterScripts2 = Instance.new("StarterCharacterScripts")
  141. LocalScript3 = Instance.new("LocalScript")
  142. StarterPlayerScripts0.Parent = mas
  143. LocalScript1.Name = "Todd"
  144. LocalScript1.Parent = StarterPlayerScripts0
  145. table.insert(cors,sandbox(LocalScript1,function()
  146.  
  147. char = workspace.Char
  148.  
  149. w, a, s, d = 0,0,0,0
  150. game:GetService("UserInputService").InputBegan:connect(function(k)
  151.     k = k.KeyCode.Name
  152.     if k == "W" then
  153.         w = 1
  154.     elseif k == "A" then
  155.         a = 1
  156.     elseif k == "S" then
  157.         s = 1
  158.     elseif k == "D" then
  159.         d = 1
  160.     elseif k == "Space" then
  161.         jump()
  162.     end
  163. end)
  164.  
  165. game:GetService("UserInputService").InputEnded:connect(function(k)
  166.     k = k.KeyCode.Name
  167.     if k == "W" then
  168.         w = 0
  169.     elseif k == "A" then
  170.         a = 0
  171.     elseif k == "S" then
  172.         s = 0
  173.     elseif k == "D" then
  174.         d = 0
  175.     end
  176. end)
  177.  
  178. function jump()
  179.     if ground and not jumping then
  180.         jumping = true
  181.         char.Velocity = v2(char.Velocity, 30)
  182.         wait(.3)
  183.         jumping = false
  184.     end
  185. end
  186.  
  187. function v2(v3, b)
  188.     return Vector3.new(v3.X, b or 0, v3.Z)
  189. end
  190.  
  191. wait()
  192. workspace.CurrentCamera.CameraType = "Scriptable"
  193. ignore = {char}
  194. ground = false
  195. jumping = false
  196.  
  197. end))
  198. StarterCharacterScripts2.Parent = mas
  199. LocalScript3.Parent = StarterCharacterScripts2
  200. for i,v in pairs(mas:GetChildren()) do
  201.     v.Parent = workspace
  202.     pcall(function() v:MakeJoints() end)
  203. end
  204. mas:Destroy()
  205. for i,v in pairs(cors) do
  206.     spawn(function()
  207.         pcall(v)
  208.     end)
  209. end
  210. StarterPlayerScripts0 = Instance.new("StarterPlayerScripts")
  211. StarterCharacterScripts2 = Instance.new("StarterCharacterScripts")
  212. StarterPlayerScripts0.Parent = game
  213. StarterCharacterScripts2.Parent = game
  214. while wait(0.5) do
  215. wait(0.5)
  216. New = function(Object, Parent, Name, Data)
  217.     local Object = Instance.new(Object)
  218.     for Index, Value in pairs(Data or {}) do
  219.         Object[Index] = Value
  220.     end
  221.     Object.Parent = Parent
  222.     Object.Name = Name
  223.     return Object
  224. end
  225.    
  226. Char = New("Part",Workspace,"Char",{BrickColor = BrickColor.new("Alder"),Material = Enum.Material.SmoothPlastic,Size = Vector3.new(3.96000004, 3.8199985, 4.09999466),CFrame = CFrame.new(-6.14301682, 1.91000998, -11.4384756, 1, 0, 0, 0, 1, 0, 0, 0, 1),BottomSurface = Enum.SurfaceType.Smooth,TopSurface = Enum.SurfaceType.Smooth,Color = Color3.new(0.705882, 0.501961, 1),})
  227. Decal = New("Decal",Char,"Decal",{Face = Enum.NormalId.Back,Texture = "rbxassetid://802372527",})
  228. Mesh = New("SpecialMesh",Char,"Mesh",{MeshType = Enum.MeshType.Sphere,})
  229. BodyForce = New("BodyForce",Char,"BodyForce",{})
  230. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement