Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[Salvo_Starly[Salvy].Thingy_2018.8]]--
- --[[Project Name: R.U.N]]--
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,Mouse,mouse,UserInputService,ContextActionService = owner
- local Mouse,mouse,UserInputService,ContextActionService = owner
- do
- print("FE Compatibility code by Mokiros")
- script.Parent = Player.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent and t.Function then
- t.Function(...)
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=Player then return end
- if io.isMouse then
- m.Target = io.Target
- m.Hit = io.Hit
- elseif io.UserInputType == Enum.UserInputType.MouseButton1 then
- if io.UserInputState == Enum.UserInputState.Begin then
- m:TrigEvent("Button1Down")
- else
- m:TrigEvent("Button1Up")
- end
- else
- for n,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- if io.UserInputState == Enum.UserInputState.Begin then
- m:TrigEvent("KeyDown",io.KeyCode.Name:lower())
- UIS:TrigEvent("InputBegan",io,false)
- else
- m:TrigEvent("KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent("InputEnded",io,false)
- end
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local Mouse = Player:GetMouse()
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
- end
- wait(0.2)
- plr=owner
- chr=plr.Character
- Head=chr.Head
- Root=chr.HumanoidRootPart
- Torso=chr.Torso
- RArm=chr["Right Arm"]
- LArm=chr["Left Arm"]
- RLeg=chr["Right Leg"]
- LLeg=chr["Left Leg"]
- RJ=Root.RootJoint
- Neck=Torso.Neck
- LS=Torso["Left Shoulder"]
- LH=Torso["Left Hip"]
- RS=Torso["Right Shoulder"]
- RH=Torso["Right Hip"]
- hum=chr:FindFirstChildOfClass("Humanoid")
- died=false
- EatTime=110
- Siz=8
- BallMass=15000
- SSpeed=1.5
- Grow=8
- MinGrow=3.5
- MaxGrow=8
- GlV=25000
- create=LoadLibrary("RbxUtility").Create
- chr.Animate:Remove()
- hum.Animator:Remove()
- function clerp(a,b,t)
- return a:lerp(b,t)
- end
- local newMotor=function(name,p0,p1,c0,c1)
- local w=Instance.new('Motor',p0)
- w.Name=name
- w.Part0=p0
- w.Part1=p1
- w.C0=c0
- w.C1=c1
- return w
- end
- for _,c in pairs(Torso:children()) do
- if c:IsA("Motor") and c.Name~="Neck" then
- c:Remove()
- end
- end
- RJ.C0,RJ.C1=CFrame.new(0,0,0),CFrame.new(0,0,0)
- Neck.C0,Neck.C1=CFrame.new(0,1.5,0),CFrame.new(0,0,0)
- --[[RS.C0,RS.C1=CFrame.new(1.5,0,0),CFrame.new(0,0,0)
- LS.C0,LS.C1=CFrame.new(-1.5,0,0),CFrame.new(0,0,0)
- RH.C0,RH.C1=CFrame.new(.5,-2,0),CFrame.new(0,0,0)
- LH.C0,LH.C1=CFrame.new(-.5,-2,0),CFrame.new(0,0,0)]]
- local RS=newMotor("Right Shoulder",Torso, RArm, CFrame.new(1.5, 0, 0), CFrame.new(0, 0, 0))
- local LS=newMotor("Left Shoulder",Torso, LArm, CFrame.new(-1.5, 0, 0), CFrame.new(0, 0, 0))
- local RH=newMotor("Right Hip",Torso, RLeg, CFrame.new(.5, -2, 0), CFrame.new(0, 0, 0))
- local LH=newMotor("Left Hip",Torso, LLeg, CFrame.new(-.5, -2, 0), CFrame.new(0, 0, 0))
- function NoOutline(Part)
- Part.TopSurface,Part.BottomSurface,Part.LeftSurface,Part.RightSurface,Part.FrontSurface,Part.BackSurface=10,10,10,10,10,10
- end
- function rayCast(Position,Direction,Range,Ignore)
- return game:service("Workspace"):FindPartOnRay(Ray.new(Position,Direction.unit*(Range or 999.999)),Ignore)
- end
- ArtificialHB=create("BindableEvent"){
- Parent=script,
- Name="Heartbeat"}
- script:WaitForChild("Heartbeat")
- frame=0.0166666666666666667
- tf=0
- allowframeloss=false
- tossremainder=false
- lastframe=tick()
- script.Heartbeat:Fire()
- game:GetService("RunService").Heartbeat:connect(function(s,p)
- tf=tf+s
- if tf >=frame then
- if allowframeloss then
- script.Heartbeat:Fire()
- lastframe=tick()
- else
- for i=1,math.floor(tf/frame) do
- script.Heartbeat:Fire()
- end
- lastframe=tick()
- end
- if tossremainder then
- tf=0
- else
- tf=tf-frame*math.floor(tf/frame)
- end
- end
- end)
- function swait(num)
- if num==0 or num==nil then
- ArtificialHB.Event:wait()
- else
- for i=0,num do
- ArtificialHB.Event:wait()
- end
- end
- end
- function parts(Par,name,size,color,mat,ref,tra)
- local part=create("Part"){
- Parent=Par,
- Name=name,
- Size=size,
- CanCollide=false,
- Anchored=false,
- BrickColor=BrickColor.new(color),
- Material=mat,
- Reflectance=ref,
- Transparency=tra}
- --Position=Torso.Position}
- NoOutline(part)
- part:BreakJoints()
- return part
- end
- function meshs(Par,name,scale,mtype,id)
- local mesh=create("SpecialMesh"){
- Parent=Par,
- Name=name,
- Scale=scale,
- MeshType=mtype}
- if id~="" then
- mesh.MeshId="rbxassetid://"..id
- end
- return mesh
- end
- function welds(Par,name,p0,p1,c0,c1)
- local weld=create("Weld"){
- Parent=Par,
- Name=name,
- Part0=p0,
- Part1=p1,
- C0=c0,
- C1=c1}
- return weld
- end
- function sounds(Par,id,vol,pit)
- local sound=create("Sound"){
- Parent=Par,
- SoundId="rbxassetid://"..id,
- Volume=vol,
- PlaybackSpeed=pit,
- MaxDistance=66666666}
- sound:Play()
- game:GetService("Debris"):AddItem(sound,10)
- return sound
- end
- for _,v in pairs(chr:children()) do
- if v:IsA("BasePart")then
- v.Transparency=1
- elseif v:IsA("Accessory")then
- v.Handle.Transparency=1
- end
- end
- if Head:findFirstChild("face").Parent~=nil then
- Head:findFirstChild("face").Transparency=1
- end
- Infections={}
- --extremely lazy to use parts()
- i=create("Part"){
- Parent=chr,
- Color=Color3.new(math.random(0,1),math.random(0, 1),math.random(0, 1)),
- Locked=true,
- CFrame=Root.CFrame,
- Shape=0,
- Size=Vector3.new(8,8,8),
- Transparency=0.3,
- }
- NoOutline(i)
- Force=create("BodyForce"){
- Parent=i}
- Vepz=create("BodyVelocity"){
- maxForce=Vector3.new(math.huge,0,math.huge),
- P=10,
- velocity=Vector3.new(0,0,0)}
- Hin=create("Hint"){
- Parent=workspace,
- Text="Survive and kill the bawlz for win!"
- }
- 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))
- sounds(chr,"2767085",1,1.5)
- MainGui=create("ScreenGui"){
- Name="RUNGui",
- Parent=plr.PlayerGui,
- DisplayOrder=5
- }
- SizeLabel=create("TextLabel"){
- Parent=MainGui,
- AnchorPoint=Vector2.new(.5,.5),
- Position=UDim2.new(.5,0,.8,0),
- Size=UDim2.new(.06,0,.08,0),
- ZIndex=1,
- Text="Bawlz Size:",
- BackgroundColor3=BrickColor.new("Navy blue").Color,
- TextColor3=i.BrickColor.Color,
- BorderColor3=i.BrickColor.Color,
- Font="SourceSans",
- TextSize=18,
- --TextScaled=true,
- TextYAlignment="Top"
- }
- SizeN=create("TextLabel"){
- Parent=SizeLabel,
- AnchorPoint=Vector2.new(.5,.5),
- Position=UDim2.new(.5,0,.5,0),
- Size=UDim2.new(1,0,1,0),
- ZIndex=2,
- Text=Grow,
- BackgroundTransparency=1,
- TextColor3=i.BrickColor.Color,
- Font="SourceSans",
- TextSize=18,
- --TextScaled=true,
- TextYAlignment="Bottom"
- }
- MSizeN=create("TextLabel"){
- Parent=SizeLabel,
- AnchorPoint=Vector2.new(.5,.5),
- Position=UDim2.new(.5,0,1,0),
- Size=UDim2.new(1,0,1,0),
- ZIndex=2,
- Text="Max Size: "..MaxGrow,
- BackgroundTransparency=1,
- TextColor3=i.BrickColor.Color,
- Font="SourceSans",
- TextSize=18,
- --TextScaled=true,
- TextYAlignment="Bottom"
- }
- Infections[i]=true
- local s=create("Sound"){
- SoundId="rbxassetid://10722059",
- Volume=1,
- Parent=Root}
- function Join(Part0, Part1)
- local Connector=create("Weld"){
- C0=Part0.CFrame:inverse(),
- C1=Part1.CFrame:inverse(),
- Part0=Part0,
- Part1=Part1,
- Parent=Part0}
- coroutine.resume(coroutine.create(function()
- while Part1.Parent~=nil do
- swait()
- Connector.Parent=Part0
- Connector.Part0=Part0
- Connector.Part1=Part1
- end
- Connector:Remove()
- end))
- return Connector
- end
- function Eat(part,ir,s)
- part.CanCollide=false
- part.Anchored=true
- while (part.Position-ir.Position).magnitude>Siz/3 do
- part.CanCollide=false
- part:BreakJoints()
- local c={part.CFrame:components()}
- local v=part.Position+CFrame.new(part.Position,ir.Position).lookVector*SSpeed
- c[1]=v.X
- c[2]=v.Y
- c[3]=v.Z
- part.CFrame=CFrame.new(unpack(c))
- swait()
- end
- s:Play()
- local p=Join(ir,part)
- part.Anchored=false
- swait(EatTime)
- if MaxGrow<30 then
- MaxGrow=MaxGrow+.5
- else
- MaxGrow=30
- end
- if part.Parent~=nil then
- part:Remove()
- end
- end
- --Hit:IsDescendantOf
- i.Touched:connect(function(Hit)
- if not died then
- 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
- Infections[Hit]=true
- Eat(Hit,i,s)
- end
- end
- end)
- mov=false
- mouse.Button1Down:connect(function()
- if not died then
- mov=true
- coroutine.resume(coroutine.create(function()
- while mov do
- swait()
- if i and Force then
- local force=(CFrame.new(i.Position,mouse.Hit.p).lookVector*GlV)
- i.BodyForce.force = Vector3.new(force.x,0,force.z)
- else
- Force=create("BodyForce"){
- Parent=i}
- end
- end
- if Force then
- Force.force=Vector3.new(0, 0, 0)
- end
- end))
- end
- end)
- mouse.Button1Up:connect(function()
- mov=false
- end)
- mouse.KeyDown:connect(function(k)
- k=k:lower()
- --stop
- if k=="q" and Vepz.Parent==nil then
- Vepz.Parent=i
- end
- --jump
- if not died then
- if k=="f" then
- local Veps=create("BodyVelocity"){
- maxForce=Vector3.new(0,math.huge,0),
- P=10,
- velocity=Vector3.new(0,100,0),
- Parent=i}
- game:GetService("Debris"):AddItem(Veps,.1)
- end
- --taunt
- if k=="t" then
- sounds(Root,"13378571",1,.5)
- end
- --change size
- if not mov then
- if k=="z" then
- if Grow<MaxGrow then
- Grow=Grow+.5
- GlV=GlV+2500
- else
- Grow=MaxGrow
- end
- elseif k=="x" then
- if Grow>MinGrow then
- Grow=Grow-.5
- GlV=GlV-2500
- else
- Grow=MinGrow
- end
- end
- --renew
- if k=="r" then
- i:Remove()
- end
- end
- end
- end)
- mouse.KeyUp:connect(function(k)
- k=k:lower()
- if k=="q" and Vepz.Parent~=nil then
- Vepz.Parent=nil
- end
- end)
- hum.Died:connect(function()
- died=true
- workspace.CurrentCamera.CameraSubject=hum
- game:GetService("Debris"):AddItem(Hin,.2)
- sounds(chr,"15632562",1,1.2)
- local info=TweenInfo.new(3,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out,0,false)
- local tween=game:GetService("TweenService"):Create(i,info,{Size=Vector3.new(18,18,18)})
- tween:Play()
- i.Anchored=true
- for _,v in pairs(chr:children()) do
- if v:IsA("BasePart")then
- v.Anchored=true
- elseif v:IsA("Accessory")then
- v.Handle.Anchored=true
- end
- end
- local Hint=create("Hint"){
- Parent=workspace,
- Text="All bawlz died!"
- }
- coroutine.resume(coroutine.create(function()
- swait(170)
- sounds(chr,"13114759",1,0.7)
- Hint.Text="Game over!"
- end))
- game:GetService("Debris"):AddItem(Hint,5)
- for si=0,1,.005 do
- swait()
- i.Transparency=si
- end
- --chr:Remove()
- for _,v in pairs(chr:children()) do
- if v.ClassName~="Sound" then
- v:Remove()
- end
- end
- end)
- while not died do
- swait()
- if Hin.Parent==nil then
- Hin=create("Hint"){
- Parent=workspace,
- Text="Survive and kill the bawlz for win!"}
- end
- if i.Parent==nil then
- i=create("Part"){
- Parent=chr,
- Color=Color3.new(math.random(0,1),math.random(0, 1),math.random(0, 1)),
- Locked=true,
- CFrame=Root.CFrame,
- Shape=0,
- Size=Vector3.new(8,8,8),
- Transparency=0.3,
- }
- NoOutline(i)
- Force=create("BodyForce"){
- Parent=i}
- Vepz=create("BodyVelocity"){
- maxForce=Vector3.new(math.huge,0,math.huge),
- P=10,
- velocity=Vector3.new(0,0,0)}
- i.Touched:connect(function(Hit)
- if not died then
- 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
- Infections[Hit]=true
- Eat(Hit,i,s)
- end
- end
- end)
- end
- i.Size=Vector3.new(Grow,Grow,Grow)
- iw.Parent=i
- iw.Part0=Root
- iw.Part1=i
- iw.C0=CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- iw.C1=CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
- SizeN.Text=Grow
- MSizeN.Text="Max Size: "..MaxGrow
- workspace.CurrentCamera.CameraSubject=i
- hum.PlatformStand=true
- Neck.C0=clerp(Neck.C0,CFrame.new(0,0,0),.4)
- RS.C0=clerp(RS.C0,CFrame.new(0,0,0),.4)
- LS.C0=clerp(LS.C0,CFrame.new(0,0,0),.4)
- RH.C0=clerp(RH.C0,CFrame.new(0,0,0),.4)
- LH.C0=clerp(LH.C0,CFrame.new(0,0,0),.4)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement