SHOW:
|
|
- or go back to the newest paste.
| 1 | --just put this on the top of a script and boom 89% works | |
| 2 | --note this does not work on big scripts | |
| 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,game,owner = owner,game | |
| 5 | local RealPlayer = Player | |
| 6 | do | |
| 7 | local rp = RealPlayer | |
| 8 | script.Parent = rp.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,Functions={},Connect=function(self,f)table.insert(self.Functions,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 then | |
| 34 | for _,f in pairs(t.Functions) do | |
| 35 | f(...) | |
| 36 | end | |
| 37 | end | |
| 38 | end | |
| 39 | m.TrigEvent = te | |
| 40 | UIS.TrigEvent = te | |
| 41 | ||
| 42 | Event.OnServerEvent:Connect(function(plr,io) | |
| 43 | if plr~=rp then return end | |
| 44 | m.Target = io.Target | |
| 45 | m.Hit = io.Hit | |
| 46 | if not io.isMouse then | |
| 47 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 48 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 49 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
| 50 | end | |
| 51 | for _,t in pairs(CAS.Actions) do | |
| 52 | for _,k in pairs(t.Keys) do | |
| 53 | if k==io.KeyCode then | |
| 54 | t.Function(t.Name,io.UserInputState,io) | |
| 55 | end | |
| 56 | end | |
| 57 | end | |
| 58 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 59 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 60 | end | |
| 61 | end) | |
| 62 | Event.Parent = NLS([==[ | |
| 63 | local Player = game:GetService("Players").LocalPlayer
| |
| 64 | local Event = script:WaitForChild("UserInput_Event")
| |
| 65 | ||
| 66 | local Mouse = Player:GetMouse() | |
| 67 | local UIS = game:GetService("UserInputService")
| |
| 68 | local input = function(io,a) | |
| 69 | if a then return end | |
| 70 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 71 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 72 | end | |
| 73 | UIS.InputBegan:Connect(input) | |
| 74 | UIS.InputEnded:Connect(input) | |
| 75 | ||
| 76 | local h,t | |
| 77 | --Give the server mouse data 30 times every second, but only if the values changed | |
| 78 | --If player is not moving their mouse, client won't fire events | |
| 79 | while wait(1/30) do | |
| 80 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 81 | h,t=Mouse.Hit,Mouse.Target | |
| 82 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 83 | end | |
| 84 | end]==],Player.Character) | |
| 85 | ||
| 86 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 87 | --Real game object | |
| 88 | local _rg = game | |
| 89 | ||
| 90 | --Metatable for fake service | |
| 91 | local fsmt = {
| |
| 92 | __index = function(self,k) | |
| 93 | local s = rawget(self,"_RealService") | |
| 94 | if s then return s[k] end | |
| 95 | end, | |
| 96 | __newindex = function(self,k,v) | |
| 97 | local s = rawget(self,"_RealService") | |
| 98 | if s then s[k]=v end | |
| 99 | end, | |
| 100 | __call = function(self,...) | |
| 101 | local s = rawget(self,"_RealService") | |
| 102 | if s then return s(...) end | |
| 103 | end | |
| 104 | } | |
| 105 | local function FakeService(t,RealService) | |
| 106 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
| 107 | return setmetatable(t,fsmt) | |
| 108 | end | |
| 109 | ||
| 110 | --Fake game object | |
| 111 | local g = {
| |
| 112 | GetService = function(self,s) | |
| 113 | return self[s] | |
| 114 | end, | |
| 115 | Players = FakeService({
| |
| 116 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
| |
| 117 | },"Players"), | |
| 118 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 119 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 120 | } | |
| 121 | - | local Health = 9000 |
| 121 | + | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) |
| 122 | g.service = g.GetService | |
| 123 | - | PlayerSpeed = 16 |
| 123 | + | |
| 124 | g.RunService = FakeService({
| |
| 125 | - | ypcall(function() |
| 125 | + | RenderStepped = _rg:GetService("RunService").Heartbeat,
|
| 126 | - | char.Shirt:Destroy() |
| 126 | + | BindToRenderStep = function(self,name,_,fun) |
| 127 | - | char.Pants:Destroy() |
| 127 | + | self._btrs[name] = self.Heartbeat:Connect(fun) |
| 128 | - | shirt = Instance.new("Shirt", char)
|
| 128 | + | end, |
| 129 | - | shirt.Name = "Shirt" |
| 129 | + | UnbindFromRenderStep = function(self,name) |
| 130 | - | pants = Instance.new("Pants", char)
|
| 130 | + | self._btrs[name]:Disconnect() |
| 131 | - | pants.Name = "Pants" |
| 131 | + | end, |
| 132 | - | char.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=298260655" |
| 132 | + | },"RunService") |
| 133 | - | char.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=298260668" |
| 133 | + | |
| 134 | setmetatable(g,{
| |
| 135 | __index=function(self,s) | |
| 136 | - | Debounces = {
|
| 136 | + | return _rg:GetService(s) or typeof(_rg[s])=="function" |
| 137 | - | CanAttack = true; |
| 137 | + | and function(_,...)return _rg[s](_rg,...)end or _rg[s] |
| 138 | - | NoIdl = false; |
| 138 | + | end, |
| 139 | - | Slashing = false; |
| 139 | + | __newindex = fsmt.__newindex, |
| 140 | - | Slashed = false; |
| 140 | + | __call = fsmt.__call |
| 141 | - | RPunch = false; |
| 141 | + | }) |
| 142 | - | RPunched = false; |
| 142 | + | --Changing owner to fake player object to support owner:GetMouse() |
| 143 | - | LPunch = false; |
| 143 | + | game,owner = g,g.Players.LocalPlayer |
| 144 | - | LPunched = false; |
| 144 | + | |
| 145 | - | } |
| 145 | + | |
| 146 | ||
| 147 | - | local trappedTorsos = {}
|
| 147 | + | |
| 148 | Player = Services.Players.LocalPlayer | |
| 149 | - | ---Functions |
| 149 | + | |
| 150 | BodyParts={}
| |
| 151 | - | function FndHm(flnm) |
| 151 | + | |
| 152 | - | for i,v in pairs(flnm:GetChildren()) do |
| 152 | + | |
| 153 | - | if v:IsA("Humanoid") then
|
| 153 | + | |
| 154 | - | return v |
| 154 | + | |
| 155 | return deg * math.pi / 180 | |
| 156 | end | |
| 157 | deg = function(rad) | |
| 158 | - | local hum=FndHm(char) |
| 158 | + | |
| 159 | - | --hum.Name="" |
| 159 | + | |
| 160 | dist = function(p1,p2) | |
| 161 | r,e = ypcall(function() | |
| 162 | - | function chrDes(inst) |
| 162 | + | |
| 163 | - | local ret=nil |
| 163 | + | |
| 164 | - | for _,v in pairs(game.Players:GetChildren()) do |
| 164 | + | |
| 165 | - | if inst:IsDescendantOf(v) then |
| 165 | + | |
| 166 | - | ret=v |
| 166 | + | |
| 167 | - | break |
| 167 | + | |
| 168 | if not r then p1 = p1 end | |
| 169 | return math.sqrt( (p2.X-p1.X)^2 + (p2.Y-p1.Y)^2 + (p2.Z-p1.Z)^2 ) | |
| 170 | - | return ret |
| 170 | + | |
| 171 | ||
| 172 | function GetChar() | |
| 173 | - | -- |
| 173 | + | |
| 174 | - | function get(a) |
| 174 | + | |
| 175 | - | local cont={}
|
| 175 | + | |
| 176 | - | for i,v in pairs(a:GetChildren()) do |
| 176 | + | |
| 177 | - | if v==char then |
| 177 | + | |
| 178 | - | else |
| 178 | + | |
| 179 | - | table.insert(cont,v) |
| 179 | + | |
| 180 | - | pcall(function() |
| 180 | + | |
| 181 | - | for _,b in pairs(get(v)) do |
| 181 | + | |
| 182 | - | table.insert(cont,b) |
| 182 | + | |
| 183 | function Died() | |
| 184 | for i,v in pairs(GetChar():children'') do | |
| 185 | if v.ClassName == 'Part' then | |
| 186 | table.insert(BodyParts,{v.CFrame,v})
| |
| 187 | - | return cont |
| 187 | + | |
| 188 | v.Parent=workspace | |
| 189 | - | for _,v in pairs(get(game.Workspace)) do |
| 189 | + | |
| 190 | - | if v:IsA("Sparkles") or v:IsA("Fire") then
|
| 190 | + | |
| 191 | - | v:Destroy() |
| 191 | + | |
| 192 | ||
| 193 | wait(3) | |
| 194 | for i,v in pairs(BodyParts) do | |
| 195 | - | -- |
| 195 | + | |
| 196 | - | function inT(qur,tbl) |
| 196 | + | |
| 197 | - | local a=false |
| 197 | + | |
| 198 | - | for i,v in pairs(tbl) do |
| 198 | + | |
| 199 | - | if v==qur then |
| 199 | + | |
| 200 | - | a=true |
| 200 | + | |
| 201 | - | break |
| 201 | + | |
| 202 | - | else |
| 202 | + | |
| 203 | - | a=false |
| 203 | + | |
| 204 | v[2].CFrame=v[1] | |
| 205 | end)) | |
| 206 | - | return a |
| 206 | + | |
| 207 | end | |
| 208 | ||
| 209 | - | -- |
| 209 | + | |
| 210 | - | function Tween(a,b,c) |
| 210 | + | |
| 211 | - | return a+(b-a)*c |
| 211 | + | |
| 212 | if v[3] then | |
| 213 | v[2]:Remove() | |
| 214 | - | -- |
| 214 | + | |
| 215 | - | function Avg(a,b) |
| 215 | + | |
| 216 | - | return CFrame.new((a.X+b.X)/2,(a.Y+b.Y)/2,(a.Z+b.Z)/2) |
| 216 | + | |
| 217 | char.Torso.CFrame=pos or CFrame.new(0,12,0) | |
| 218 | GetHum().Died:connect(Died) | |
| 219 | - | -- |
| 219 | + | |
| 220 | - | function Lerp(c1,c2,tim) |
| 220 | + | |
| 221 | - | local com1={c1.C0.X,c1.C0.Y,c1.C0.Z,c1.C0:toEulerAnglesXYZ()}
|
| 221 | + | |
| 222 | - | local com2={c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
|
| 222 | + | |
| 223 | - | for i,v in pairs(com1) do |
| 223 | + | |
| 224 | - | com1[i]=v+(com2[i]-v)*tim |
| 224 | + | |
| 225 | User: DIO | |
| 226 | - | return Cn(com1[1],com1[2],com1[3])*CA(select(4,unpack(com1))) |
| 226 | + | |
| 227 | ||
| 228 | ---Declarations | |
| 229 | - | function RLerp(c1,c2,tim) |
| 229 | + | |
| 230 | - | return c1:lerp(c2,tim) |
| 230 | + | |
| 231 | local mr=math.rad | |
| 232 | local rn=math.random | |
| 233 | - | -- |
| 233 | + | |
| 234 | - | function ALerp(c1,c2,tim) |
| 234 | + | |
| 235 | - | local com1={c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
|
| 235 | + | |
| 236 | - | local com2={c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
|
| 236 | + | |
| 237 | - | for i,v in pairs(com1) do |
| 237 | + | |
| 238 | - | com1[i]=v+(com2[i]-v)*tim |
| 238 | + | |
| 239 | local deb=game:service"Debris" | |
| 240 | - | return Cn(com1[1],com1[2],com1[3])*CA(select(4,unpack(com1))) |
| 240 | + | |
| 241 | local p=plrs.LocalPlayer | |
| 242 | local cam=wrk.CurrentCamera | |
| 243 | - | -- |
| 243 | + | |
| 244 | - | function Lerprs(ud,ud2,al) |
| 244 | + | |
| 245 | - | local a,b,c,d=ud.X.Scale,ud.X.Offset,ud.Y.Scale,ud.Y.Offset |
| 245 | + | |
| 246 | - | local a2,b2,c2,d2=ud2.X.Scale,ud2.X.Offset,ud2.Y.Scale,ud2.Y.Offset |
| 246 | + | |
| 247 | - | local x,y,z,w=(a+(a2-a)*al),(b+(b2-b)*al),(c+(c2-c)*al),(d+(d2-d)*al) |
| 247 | + | |
| 248 | - | return UDim2.new(x,y,z,w) |
| 248 | + | |
| 249 | local hed=char.Head | |
| 250 | local tor=char.Torso | |
| 251 | - | -- |
| 251 | + | |
| 252 | - | function newAnim(wld) |
| 252 | + | |
| 253 | - | local asd={["Weld"]=wld;["Int"]=0;["Frame"]=1;}
|
| 253 | + | |
| 254 | - | asd.getFrames=function() |
| 254 | + | |
| 255 | - | local num=0 |
| 255 | + | |
| 256 | - | for _,v in pairs(asd) do |
| 256 | + | |
| 257 | - | pcall(function() |
| 257 | + | |
| 258 | - | num=num+v.Length |
| 258 | + | |
| 259 | - | end) |
| 259 | + | |
| 260 | local curws=16 | |
| 261 | - | return num |
| 261 | + | |
| 262 | local ift={}
| |
| 263 | - | return asd |
| 263 | + | |
| 264 | local run=false | |
| 265 | local stance="Cane" | |
| 266 | - | -- |
| 266 | + | |
| 267 | - | function newKF(tab,c0,lng,off) |
| 267 | + | local Health = 9000 |