Advertisement
memberhero

R.U.N Script FE

Feb 2nd, 2019
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[Salvo_Starly[Salvy].Thingy_2018.8]]--
  2. --[[Project Name: R.U.N]]--
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  5. local Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. elseif io.UserInputType == Enum.UserInputType.MouseButton1 then
  46. if io.UserInputState == Enum.UserInputState.Begin then
  47. m:TrigEvent("Button1Down")
  48. else
  49. m:TrigEvent("Button1Up")
  50. end
  51. else
  52. for n,t in pairs(CAS.Actions) do
  53. for _,k in pairs(t.Keys) do
  54. if k==io.KeyCode then
  55. t.Function(t.Name,io.UserInputState,io)
  56. end
  57. end
  58. end
  59. if io.UserInputState == Enum.UserInputState.Begin then
  60. m:TrigEvent("KeyDown",io.KeyCode.Name:lower())
  61. UIS:TrigEvent("InputBegan",io,false)
  62. else
  63. m:TrigEvent("KeyUp",io.KeyCode.Name:lower())
  64. UIS:TrigEvent("InputEnded",io,false)
  65. end
  66. end
  67. end)
  68. Event.Parent = NLS([==[
  69. local Player = game:GetService("Players").LocalPlayer
  70. local Event = script:WaitForChild("UserInput_Event")
  71.  
  72. local UIS = game:GetService("UserInputService")
  73. local input = function(io,a)
  74. if a then return end
  75. --Since InputObject is a client-side instance, we create and pass table instead
  76. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  77. end
  78. UIS.InputBegan:Connect(input)
  79. UIS.InputEnded:Connect(input)
  80.  
  81. local Mouse = Player:GetMouse()
  82. local h,t
  83. --Give the server mouse data 30 times every second, but only if the values changed
  84. --If player is not moving their mouse, client won't fire events
  85. while wait(1/30) do
  86. if h~=Mouse.Hit or t~=Mouse.Target then
  87. h,t=Mouse.Hit,Mouse.Target
  88. Event:FireServer({isMouse=true,Target=t,Hit=h})
  89. end
  90. end]==],Player.Character)
  91. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  92.  
  93. end
  94. wait(0.2)
  95. plr=owner
  96. chr=plr.Character
  97. Head=chr.Head
  98. Root=chr.HumanoidRootPart
  99. Torso=chr.Torso
  100. RArm=chr["Right Arm"]
  101. LArm=chr["Left Arm"]
  102. RLeg=chr["Right Leg"]
  103. LLeg=chr["Left Leg"]
  104. RJ=Root.RootJoint
  105. Neck=Torso.Neck
  106. LS=Torso["Left Shoulder"]
  107. LH=Torso["Left Hip"]
  108. RS=Torso["Right Shoulder"]
  109. RH=Torso["Right Hip"]
  110. hum=chr:FindFirstChildOfClass("Humanoid")
  111.  
  112. died=false
  113. EatTime=110
  114. Siz=8
  115. BallMass=15000
  116. SSpeed=1.5
  117. Grow=8
  118. MinGrow=3.5
  119. MaxGrow=8
  120. GlV=25000
  121.  
  122. create=LoadLibrary("RbxUtility").Create
  123.  
  124. chr.Animate:Remove()
  125. hum.Animator:Remove()
  126.  
  127. function clerp(a,b,t)
  128. return a:lerp(b,t)
  129. end
  130.  
  131. local newMotor=function(name,p0,p1,c0,c1)
  132. local w=Instance.new('Motor',p0)
  133. w.Name=name
  134. w.Part0=p0
  135. w.Part1=p1
  136. w.C0=c0
  137. w.C1=c1
  138. return w
  139. end
  140. for _,c in pairs(Torso:children()) do
  141. if c:IsA("Motor") and c.Name~="Neck" then
  142. c:Remove()
  143. end
  144. end
  145.  
  146.  
  147. RJ.C0,RJ.C1=CFrame.new(0,0,0),CFrame.new(0,0,0)
  148. Neck.C0,Neck.C1=CFrame.new(0,1.5,0),CFrame.new(0,0,0)
  149. --[[RS.C0,RS.C1=CFrame.new(1.5,0,0),CFrame.new(0,0,0)
  150. LS.C0,LS.C1=CFrame.new(-1.5,0,0),CFrame.new(0,0,0)
  151. RH.C0,RH.C1=CFrame.new(.5,-2,0),CFrame.new(0,0,0)
  152. LH.C0,LH.C1=CFrame.new(-.5,-2,0),CFrame.new(0,0,0)]]
  153. local RS=newMotor("Right Shoulder",Torso, RArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
  154. local LS=newMotor("Left Shoulder",Torso, LArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
  155. local RH=newMotor("Right Hip",Torso, RLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0))
  156. local LH=newMotor("Left Hip",Torso, LLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0))
  157.  
  158. function NoOutline(Part)
  159. Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface=10,10,10,10,10,10
  160. end
  161.  
  162. function rayCast(Position,Direction,Range,Ignore)
  163. return game:service("Workspace"):FindPartOnRay(Ray.new(Position,Direction.unit*(Range or 999.999)),Ignore)
  164. end
  165.  
  166. ArtificialHB=create("BindableEvent"){
  167. Parent=script,
  168. Name="Heartbeat"}
  169.  
  170. script:WaitForChild("Heartbeat")
  171.  
  172. frame=0.0166666666666666667
  173. tf=0
  174. allowframeloss=false
  175. tossremainder=false
  176. lastframe=tick()
  177. script.Heartbeat:Fire()
  178.  
  179. game:GetService("RunService").Heartbeat:connect(function(s,p)
  180. tf=tf+s
  181. if tf >=frame then
  182. if allowframeloss then
  183. script.Heartbeat:Fire()
  184. lastframe=tick()
  185. else
  186. for i=1,math.floor(tf/frame) do
  187. script.Heartbeat:Fire()
  188. end
  189. lastframe=tick()
  190. end
  191. if tossremainder then
  192. tf=0
  193. else
  194. tf=tf-frame*math.floor(tf/frame)
  195. end
  196. end
  197. end)
  198.  
  199. function swait(num)
  200. if num==0 or num==nil then
  201. ArtificialHB.Event:wait()
  202. else
  203. for i=0,num do
  204. ArtificialHB.Event:wait()
  205. end
  206. end
  207. end
  208.  
  209. function parts(Par,name,size,color,mat,ref,tra)
  210. local part=create("Part"){
  211. Parent=Par,
  212. Name=name,
  213. Size=size,
  214. CanCollide=false,
  215. Anchored=false,
  216. BrickColor=BrickColor.new(color),
  217. Material=mat,
  218. Reflectance=ref,
  219. Transparency=tra}
  220. --Position=Torso.Position}
  221. NoOutline(part)
  222. part:BreakJoints()
  223. return part
  224. end
  225.  
  226. function meshs(Par,name,scale,mtype,id)
  227. local mesh=create("SpecialMesh"){
  228. Parent=Par,
  229. Name=name,
  230. Scale=scale,
  231. MeshType=mtype}
  232. if id~="" then
  233. mesh.MeshId="rbxassetid://"..id
  234. end
  235. return mesh
  236. end
  237.  
  238. function welds(Par,name,p0,p1,c0,c1)
  239. local weld=create("Weld"){
  240. Parent=Par,
  241. Name=name,
  242. Part0=p0,
  243. Part1=p1,
  244. C0=c0,
  245. C1=c1}
  246. return weld
  247. end
  248.  
  249. function sounds(Par,id,vol,pit)
  250. local sound=create("Sound"){
  251. Parent=Par,
  252. SoundId="rbxassetid://"..id,
  253. Volume=vol,
  254. PlaybackSpeed=pit,
  255. MaxDistance=66666666}
  256. sound:Play()
  257. game:GetService("Debris"):AddItem(sound,10)
  258. return sound
  259. end
  260.  
  261. for _,v in pairs(chr:children()) do
  262. if v:IsA("BasePart")then
  263. v.Transparency=1
  264. elseif v:IsA("Accessory")then
  265. v.Handle.Transparency=1
  266. end
  267. end
  268.  
  269. if Head:findFirstChild("face").Parent~=nil then
  270. Head:findFirstChild("face").Transparency=1
  271. end
  272.  
  273. Infections={}
  274.  
  275. --extremely lazy to use parts()
  276. i=create("Part"){
  277. Parent=chr,
  278. Color=Color3.new(math.random(0,1),math.random(0, 1),math.random(0, 1)),
  279. Locked=true,
  280. CFrame=Root.CFrame,
  281. Shape=0,
  282. Size=Vector3.new(8,8,8),
  283. Transparency=0.3,
  284. }
  285. NoOutline(i)
  286.  
  287. Force=create("BodyForce"){
  288. Parent=i}
  289.  
  290. Vepz=create("BodyVelocity"){
  291. maxForce=Vector3.new(math.huge,0,math.huge),
  292. P=10,
  293. velocity=Vector3.new(0,0,0)}
  294.  
  295. Hin=create("Hint"){
  296. Parent=workspace,
  297. Text="Survive and kill the bawlz for win!"
  298. }
  299.  
  300.  
  301. iw=welds(i,"MainWeld",Root,i,CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1))
  302.  
  303.  
  304. sounds(chr,"2767085",1,1.5)
  305.  
  306.  
  307. MainGui=create("ScreenGui"){
  308. Name="RUNGui",
  309. Parent=plr.PlayerGui,
  310. DisplayOrder=5
  311. }
  312.  
  313. SizeLabel=create("TextLabel"){
  314. Parent=MainGui,
  315. AnchorPoint=Vector2.new(.5,.5),
  316. Position=UDim2.new(.5,0,.8,0),
  317. Size=UDim2.new(.06,0,.08,0),
  318. ZIndex=1,
  319. Text="Bawlz Size:",
  320. BackgroundColor3=BrickColor.new("Navy blue").Color,
  321. TextColor3=i.BrickColor.Color,
  322. BorderColor3=i.BrickColor.Color,
  323. Font="SourceSans",
  324. TextSize=18,
  325. --TextScaled=true,
  326. TextYAlignment="Top"
  327. }
  328.  
  329. SizeN=create("TextLabel"){
  330. Parent=SizeLabel,
  331. AnchorPoint=Vector2.new(.5,.5),
  332. Position=UDim2.new(.5,0,.5,0),
  333. Size=UDim2.new(1,0,1,0),
  334. ZIndex=2,
  335. Text=Grow,
  336. BackgroundTransparency=1,
  337. TextColor3=i.BrickColor.Color,
  338. Font="SourceSans",
  339. TextSize=18,
  340. --TextScaled=true,
  341. TextYAlignment="Bottom"
  342. }
  343.  
  344. MSizeN=create("TextLabel"){
  345. Parent=SizeLabel,
  346. AnchorPoint=Vector2.new(.5,.5),
  347. Position=UDim2.new(.5,0,1,0),
  348. Size=UDim2.new(1,0,1,0),
  349. ZIndex=2,
  350. Text="Max Size: "..MaxGrow,
  351. BackgroundTransparency=1,
  352. TextColor3=i.BrickColor.Color,
  353. Font="SourceSans",
  354. TextSize=18,
  355. --TextScaled=true,
  356. TextYAlignment="Bottom"
  357. }
  358.  
  359. Infections[i]=true
  360.  
  361. local s=create("Sound"){
  362. SoundId="rbxassetid://10722059",
  363. Volume=1,
  364. Parent=Root}
  365.  
  366.  
  367. function Join(Part0, Part1)
  368. local Connector=create("Weld"){
  369. C0=Part0.CFrame:inverse(),
  370. C1=Part1.CFrame:inverse(),
  371. Part0=Part0,
  372. Part1=Part1,
  373. Parent=Part0}
  374. coroutine.resume(coroutine.create(function()
  375. while Part1.Parent~=nil do
  376. swait()
  377. Connector.Parent=Part0
  378. Connector.Part0=Part0
  379. Connector.Part1=Part1
  380. end
  381. Connector:Remove()
  382. end))
  383. return Connector
  384. end
  385.  
  386. function Eat(part,ir,s)
  387. part.CanCollide=false
  388. part.Anchored=true
  389. while (part.Position-ir.Position).magnitude>Siz/3 do
  390. part.CanCollide=false
  391. part:BreakJoints()
  392. local c={part.CFrame:components()}
  393. local v=part.Position+CFrame.new(part.Position,ir.Position).lookVector*SSpeed
  394. c[1]=v.X
  395. c[2]=v.Y
  396. c[3]=v.Z
  397. part.CFrame=CFrame.new(unpack(c))
  398. swait()
  399. end
  400. s:Play()
  401. local p=Join(ir,part)
  402. part.Anchored=false
  403. swait(EatTime)
  404. if MaxGrow<30 then
  405. MaxGrow=MaxGrow+.5
  406. else
  407. MaxGrow=30
  408. end
  409. if part.Parent~=nil then
  410. part:Remove()
  411. end
  412. end
  413.  
  414. --Hit:IsDescendantOf
  415.  
  416. i.Touched:connect(function(Hit)
  417. if not died then
  418. if Hit:GetMass()<BallMass and not Infections[Hit] and not string.match(Hit.Name,"Base") and Hit.Parent.Name~=plr.Name and Hit.Parent.Parent.Name~=plr.Name then
  419. Infections[Hit]=true
  420. Eat(Hit,i,s)
  421. end
  422. end
  423. end)
  424.  
  425. mov=false
  426. mouse.Button1Down:connect(function()
  427. if not died then
  428. mov=true
  429. coroutine.resume(coroutine.create(function()
  430. while mov do
  431. swait()
  432. if i and Force then
  433. local force=(CFrame.new(i.Position,mouse.Hit.p).lookVector*GlV)
  434. i.BodyForce.force = Vector3.new(force.x,0,force.z)
  435. else
  436. Force=create("BodyForce"){
  437. Parent=i}
  438. end
  439. end
  440. if Force then
  441. Force.force=Vector3.new(0, 0, 0)
  442. end
  443. end))
  444. end
  445. end)
  446.  
  447. mouse.Button1Up:connect(function()
  448. mov=false
  449. end)
  450.  
  451. mouse.KeyDown:connect(function(k)
  452. k=k:lower()
  453. --stop
  454. if k=="q" and Vepz.Parent==nil then
  455. Vepz.Parent=i
  456. end
  457. --jump
  458. if not died then
  459. if k=="f" then
  460. local Veps=create("BodyVelocity"){
  461. maxForce=Vector3.new(0,math.huge,0),
  462. P=10,
  463. velocity=Vector3.new(0,100,0),
  464. Parent=i}
  465. game:GetService("Debris"):AddItem(Veps,.1)
  466. end
  467. --taunt
  468. if k=="t" then
  469. sounds(Root,"13378571",1,.5)
  470. end
  471. --change size
  472. if not mov then
  473. if k=="z" then
  474. if Grow<MaxGrow then
  475. Grow=Grow+.5
  476. GlV=GlV+2500
  477. else
  478. Grow=MaxGrow
  479. end
  480. elseif k=="x" then
  481. if Grow>MinGrow then
  482. Grow=Grow-.5
  483. GlV=GlV-2500
  484. else
  485. Grow=MinGrow
  486. end
  487. end
  488. --renew
  489. if k=="r" then
  490. i:Remove()
  491. end
  492. end
  493. end
  494. end)
  495.  
  496. mouse.KeyUp:connect(function(k)
  497. k=k:lower()
  498. if k=="q" and Vepz.Parent~=nil then
  499. Vepz.Parent=nil
  500. end
  501. end)
  502.  
  503. hum.Died:connect(function()
  504. died=true
  505. workspace.CurrentCamera.CameraSubject=hum
  506. game:GetService("Debris"):AddItem(Hin,.2)
  507. sounds(chr,"15632562",1,1.2)
  508. local info=TweenInfo.new(3,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false)
  509. local tween=game:GetService("TweenService"):Create(i,info,{Size=Vector3.new(18,18,18)})
  510. tween:Play()
  511. i.Anchored=true
  512. for _,v in pairs(chr:children()) do
  513. if v:IsA("BasePart")then
  514. v.Anchored=true
  515. elseif v:IsA("Accessory")then
  516. v.Handle.Anchored=true
  517. end
  518. end
  519. local Hint=create("Hint"){
  520. Parent=workspace,
  521. Text="All bawlz died!"
  522. }
  523. coroutine.resume(coroutine.create(function()
  524. swait(170)
  525. sounds(chr,"13114759",1,0.7)
  526. Hint.Text="Game over!"
  527. end))
  528. game:GetService("Debris"):AddItem(Hint,5)
  529. for si=0,1,.005 do
  530. swait()
  531. i.Transparency=si
  532. end
  533. --chr:Remove()
  534. for _,v in pairs(chr:children()) do
  535. if v.ClassName~="Sound" then
  536. v:Remove()
  537. end
  538. end
  539. end)
  540.  
  541.  
  542.  
  543. while not died do
  544. swait()
  545. if Hin.Parent==nil then
  546. Hin=create("Hint"){
  547. Parent=workspace,
  548. Text="Survive and kill the bawlz for win!"}
  549. end
  550.  
  551. if i.Parent==nil then
  552. i=create("Part"){
  553. Parent=chr,
  554. Color=Color3.new(math.random(0,1),math.random(0, 1),math.random(0, 1)),
  555. Locked=true,
  556. CFrame=Root.CFrame,
  557. Shape=0,
  558. Size=Vector3.new(8,8,8),
  559. Transparency=0.3,
  560. }
  561. NoOutline(i)
  562.  
  563. Force=create("BodyForce"){
  564. Parent=i}
  565.  
  566. Vepz=create("BodyVelocity"){
  567. maxForce=Vector3.new(math.huge,0,math.huge),
  568. P=10,
  569. velocity=Vector3.new(0,0,0)}
  570.  
  571. i.Touched:connect(function(Hit)
  572. if not died then
  573. if Hit:GetMass()<BallMass and not Infections[Hit] and not string.match(Hit.Name,"Base") and Hit.Parent.Name~=plr.Name and Hit.Parent.Parent.Name~=plr.Name then
  574. Infections[Hit]=true
  575. Eat(Hit,i,s)
  576. end
  577. end
  578. end)
  579.  
  580. end
  581. i.Size=Vector3.new(Grow,Grow,Grow)
  582. iw.Parent=i
  583. iw.Part0=Root
  584. iw.Part1=i
  585. iw.C0=CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  586. iw.C1=CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  587.  
  588. SizeN.Text=Grow
  589. MSizeN.Text="Max Size: "..MaxGrow
  590.  
  591. workspace.CurrentCamera.CameraSubject=i
  592. hum.PlatformStand=true
  593. Neck.C0=clerp(Neck.C0,CFrame.new(0,0,0),.4)
  594. RS.C0=clerp(RS.C0,CFrame.new(0,0,0),.4)
  595. LS.C0=clerp(LS.C0,CFrame.new(0,0,0),.4)
  596. RH.C0=clerp(RH.C0,CFrame.new(0,0,0),.4)
  597. LH.C0=clerp(LH.C0,CFrame.new(0,0,0),.4)
  598. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement