SHOW:
|
|
- or go back to the newest paste.
| 1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
| 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,game,owner = owner,game | |
| 4 | local RealPlayer = Player | |
| 5 | do | |
| 6 | print("FE Compatibility code V2 by Mokiros")
| |
| 7 | local RealPlayer = RealPlayer | |
| 8 | script.Parent = RealPlayer.Character | |
| 9 | ||
| 10 | --Fake event to make stuff like Mouse.KeyDown work | |
| 11 | local Disconnect_Function = function(this) | |
| 12 | this[1].Functions[this[2]] = nil | |
| 13 | end | |
| 14 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
| |
| 15 | local FakeEvent_Metatable = {__index={
| |
| 16 | Connect = function(this,f) | |
| 17 | local i = tostring(math.random(0,10000)) | |
| 18 | while this.Functions[i] do | |
| 19 | i = tostring(math.random(0,10000)) | |
| 20 | end | |
| 21 | this.Functions[i] = f | |
| 22 | return setmetatable({this,i},Disconnect_Metatable)
| |
| 23 | end | |
| 24 | }} | |
| 25 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
| 26 | local function fakeEvent() | |
| 27 | return setmetatable({Functions={}},FakeEvent_Metatable)
| |
| 28 | end | |
| 29 | ||
| 30 | --Creating fake input objects with fake variables | |
| 31 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
| |
| 32 | FakeMouse.keyUp = FakeMouse.KeyUp | |
| 33 | FakeMouse.keyDown = FakeMouse.KeyDown | |
| 34 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 37 | end} | |
| 38 | --Merged 2 functions into one by checking amount of arguments | |
| 39 | CAS.UnbindAction = CAS.BindAction | |
| 40 | ||
| 41 | --This function will trigger the events that have been :Connect()'ed | |
| 42 | local function TriggerEvent(self,ev,...) | |
| 43 | for _,f in pairs(self[ev].Functions) do | |
| 44 | f(...) | |
| 45 | end | |
| 46 | end | |
| 47 | FakeMouse.TriggerEvent = TriggerEvent | |
| 48 | UIS.TriggerEvent = TriggerEvent | |
| 49 | ||
| 50 | --Client communication | |
| 51 | local Event = Instance.new("RemoteEvent")
| |
| 52 | Event.Name = "UserInput_Event" | |
| 53 | Event.OnServerEvent:Connect(function(plr,io) | |
| 54 | if plr~=RealPlayer then return end | |
| 55 | FakeMouse.Target = io.Target | |
| 56 | FakeMouse.Hit = io.Hit | |
| 57 | if not io.isMouse then | |
| 58 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
| 61 | end | |
| 62 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
| 63 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
| 64 | end | |
| 65 | for _,t in pairs(CAS.Actions) do | |
| 66 | for _,k in pairs(t.Keys) do | |
| 67 | if k==io.KeyCode then | |
| 68 | t.Function(t.Name,io.UserInputState,io) | |
| 69 | end | |
| 70 | end | |
| 71 | end | |
| 72 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 73 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 74 | end | |
| 75 | end) | |
| 76 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
| |
| 77 | local Mouse = owner:GetMouse() | |
| 78 | local UIS = game:GetService("UserInputService")
| |
| 79 | local input = function(io,RobloxHandled) | |
| 80 | if RobloxHandled then return end | |
| 81 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 82 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 83 | end | |
| 84 | UIS.InputBegan:Connect(input) | |
| 85 | UIS.InputEnded:Connect(input) | |
| 86 | local h,t | |
| 87 | --Give the server mouse data every second frame, but only if the values changed | |
| 88 | --If player is not moving their mouse, client won't fire events | |
| 89 | local HB = game:GetService("RunService").Heartbeat
| |
| 90 | while true do | |
| 91 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 92 | h,t=Mouse.Hit,Mouse.Target | |
| 93 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 94 | end | |
| 95 | --Wait 2 frames | |
| 96 | for i=1,2 do | |
| 97 | HB:Wait() | |
| 98 | end | |
| 99 | end]==],script) | |
| 100 | ||
| 101 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 102 | --Real game object | |
| 103 | local RealGame = game | |
| 104 | ||
| 105 | --Metatable for fake service | |
| 106 | local FakeService_Metatable = {
| |
| 107 | __index = function(self,k) | |
| 108 | local s = rawget(self,"_RealService") | |
| 109 | if s then | |
| 110 | return typeof(s[k])=="function" | |
| 111 | and function(_,...)return s[k](s,...)end or s[k] | |
| 112 | end | |
| 113 | end, | |
| 114 | __newindex = function(self,k,v) | |
| 115 | local s = rawget(self,"_RealService") | |
| 116 | if s then s[k]=v end | |
| 117 | end | |
| 118 | } | |
| 119 | local function FakeService(t,RealService) | |
| 120 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
| 121 | return setmetatable(t,FakeService_Metatable) | |
| 122 | end | |
| 123 | ||
| 124 | --Fake game object | |
| 125 | local FakeGame = {
| |
| 126 | GetService = function(self,s) | |
| 127 | return rawget(self,s) or RealGame:GetService(s) | |
| 128 | end, | |
| 129 | Players = FakeService({
| |
| 130 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
| |
| 131 | },"Players"), | |
| 132 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 133 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 134 | RunService = FakeService({
| |
| 135 | _btrs = {},
| |
| 136 | RenderStepped = RealGame:GetService("RunService").Heartbeat,
| |
| 137 | BindToRenderStep = function(self,name,_,fun) | |
| 138 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 139 | end, | |
| 140 | UnbindFromRenderStep = function(self,name) | |
| 141 | self._btrs[name]:Disconnect() | |
| 142 | end, | |
| 143 | },"RunService") | |
| 144 | } | |
| 145 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
| 146 | FakeGame.service = FakeGame.GetService | |
| 147 | FakeService(FakeGame,game) | |
| 148 | --Changing owner to fake player object to support owner:GetMouse() | |
| 149 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
| 150 | end | |
| 151 | ||
| 152 | -- Ezio Suit -- | |
| 153 | -- Local Script -- | |
| 154 | ||
| 155 | script.Parent = nil | |
| 156 | ||
| 157 | local plr = game.Players.LocalPlayer | |
| 158 | local char = plr.Character | |
| 159 | local hum = char.Humanoid | |
| 160 | local tar = char["Torso"] | |
| 161 | ||
| 162 | local par = char | |
| 163 | ||
| 164 | local capename = "sCape" | |
| 165 | if par:FindFirstChild(capename) then par[capename]:Destroy() end | |
| 166 | ||
| 167 | local Parts = {}
| |
| 168 | local capeLength = 4 -- studs | |
| 169 | local partAm = 25 | |
| 170 | local startWidth = 2.2 | |
| 171 | local endWidth = 3.4 | |
| 172 | local thickness = .1 | |
| 173 | local ups = 30 -- updates per second | |
| 174 | local clr = BrickColor.new("Really black")
| |
| 175 | local hood = true | |
| 176 | local suit = true | |
| 177 | local phys = true | |
| 178 | ||
| 179 | ||
| 180 | local widthCh = (endWidth-startWidth)/partAm | |
| 181 | local zSiz = capeLength/partAm | |
| 182 | ||
| 183 | ||
| 184 | local Model = Instance.new("Model",par)
| |
| 185 | Model.Name = capename | |
| 186 | ||
| 187 | function weld(p0,p1,c0,c1) | |
| 188 | local w = Instance.new("Weld",Model)
| |
| 189 | w.Part0 = p0 | |
| 190 | w.Part1 = p1 | |
| 191 | w.C0 = c0 or CFrame.new() | |
| 192 | w.C1 = c1 or CFrame.new() | |
| 193 | return w | |
| 194 | end | |
| 195 | ||
| 196 | function invcol(c) | |
| 197 | c = c.Color | |
| 198 | return BrickColor.new(Color3.new(1-c.b,1-c.g,1-c.r)) | |
| 199 | end | |
| 200 | ||
| 201 | local part = Instance.new("Part",Model)
| |
| 202 | Instance.new("BlockMesh",part)
| |
| 203 | part.FormFactor = "Custom" | |
| 204 | part.BrickColor = clr | |
| 205 | part.FormFactor = "Custom" | |
| 206 | part.Size = Vector3.new(.2,.2,.2) | |
| 207 | part.Parent = Model | |
| 208 | part:BreakJoints() | |
| 209 | part.Reflectance = 0 | |
| 210 | part.CanCollide = false | |
| 211 | part.Locked = true | |
| 212 | part.Mesh.Scale = Vector3.new(startWidth,thickness,1+(thickness))/.2 | |
| 213 | part.TopSurface = "Smooth" | |
| 214 | part.BottomSurface = "Smooth" | |
| 215 | weld(tar,part,CFrame.new(0,.989,0)) | |
| 216 | ||
| 217 | local tor,la,ra,ll,rl,hd = char:FindFirstChild("Torso"),char:FindFirstChild("Left Arm"),char:FindFirstChild("Right Arm"),
| |
| 218 | char:FindFirstChild("Left Leg"), char:FindFirstChild("Right Leg"), char:FindFirstChild("Head")
| |
| 219 | ||
| 220 | pcall(function() la.Transparency = 0 end) | |
| 221 | pcall(function() ra.Transparency = 0 end) | |
| 222 | pcall(function() ll.Transparency = 0 end) | |
| 223 | pcall(function() rl.Transparency = 0 end) | |
| 224 | pcall(function() hd.Transparency = 0 end) | |
| 225 | pcall(function() tar.Transparency = 0 end) | |
| 226 | ||
| 227 | if not hood or not suit then | |
| 228 | pcall(function() hd.face.Face = "Front" end) | |
| 229 | end | |
| 230 | ||
| 231 | if hood then | |
| 232 | for i,v in pairs(char:GetChildren()) do if v:IsA("Hat") then pcall(function() v.Handle.Transparency = 1 end) end end
| |
| 233 | local hood = part:Clone() | |
| 234 | hood.Parent = Model | |
| 235 | hood.Mesh:Destroy() | |
| 236 | local m = Instance.new("SpecialMesh",hood)
| |
| 237 | m.MeshId = "http://www.roblox.com/asset/?id=16952952" | |
| 238 | m.TextureId = "http://www.roblox.com/asset/?id=91740209" | |
| 239 | m.Scale = Vector3.new(1.06,1.06,1.06) | |
| 240 | m.VertexColor = Vector3.new(clr.Color.r,clr.Color.g,clr.Color.b) | |
| 241 | weld(hd,hood,CFrame.new(0,0.3,-.08)) | |
| 242 | end | |
| 243 | if suit then | |
| 244 | part.Mesh.Scale = Vector3.new(2,thickness,1+thickness)/.2 | |
| 245 | pcall(function() la.Transparency = 1 end) | |
| 246 | pcall(function() ra.Transparency = 1 end) | |
| 247 | pcall(function() ll.Transparency = 1 end) | |
| 248 | pcall(function() rl.Transparency = 1 end) | |
| 249 | pcall(function() tar.Transparency = 1 end) | |
| 250 | if hd and hood then | |
| 251 | local hd2 = hd:Clone() | |
| 252 | hd2.Parent = Model | |
| 253 | weld(hd,hd2) | |
| 254 | hd.Transparency = 1 | |
| 255 | hd2.Transparency = 0 | |
| 256 | pcall(function() hd2.face:Destroy() end) | |
| 257 | pcall(function() hd2.Mesh.Scale = hd2.Mesh.Scale + Vector3.new(.01,.01,.01) end) | |
| 258 | pcall(function() hd.face.Face = "Bottom" end) | |
| 259 | hd2.BrickColor = BrickColor.new("Really black")
| |
| 260 | local bbg = Instance.new("BillboardGui",hd2)
| |
| 261 | bbg.Size = UDim2.new(2,0,1,0) | |
| 262 | bbg.SizeOffset = Vector2.new(0,1.2) | |
| 263 | local tl = Instance.new("TextLabel",bbg)
| |
| 264 | tl.BackgroundTransparency = 1 | |
| 265 | tl.Size = UDim2.new(1,0,.4,0) | |
| 266 | tl.TextScaled = true | |
| 267 | tl.Text = char.Name--"Assassin" | |
| 268 | tl.TextTransparency = .9 | |
| 269 | tl.TextColor3 = Color3.new(1,0,0) | |
| 270 | end | |
| 271 | local p = part:Clone() | |
| 272 | p.BrickColor = BrickColor.new("Dark stone grey")
| |
| 273 | p.Reflectance = .4 | |
| 274 | p.Parent = Model | |
| 275 | p.Mesh.Scale = Vector3.new(1.2,.3,.1)/.2 | |
| 276 | weld(ra,p,CFrame.new(0,1,-.5) * CFrame.Angles(math.rad(20),0,math.rad(5))) | |
| 277 | p = p:Clone() | |
| 278 | p.Parent = Model | |
| 279 | weld(ra,p,CFrame.new(0,1,.5) * CFrame.Angles(math.rad(-20),0,math.rad(5))) | |
| 280 | ||
| 281 | p = p:Clone() | |
| 282 | p.Parent = Model | |
| 283 | p.Mesh.Scale = Vector3.new(1.2,.4,.1)/.2 | |
| 284 | weld(ra,p,CFrame.new(-.02,1.15,-.275) * CFrame.Angles(math.rad(80),math.rad(5),math.rad(2.5))) | |
| 285 | p = p:Clone() | |
| 286 | p.Parent = Model | |
| 287 | weld(ra,p,CFrame.new(-.02,1.15,.275) * CFrame.Angles(math.rad(-80),math.rad(-5),math.rad(2.5))) | |
| 288 | ||
| 289 | p = p:Clone() | |
| 290 | p.Parent = Model | |
| 291 | p.Mesh.Scale = Vector3.new(1.2,.2,.1)/.2 | |
| 292 | weld(ra,p,CFrame.new(-.03,1.185,0) * CFrame.Angles(math.rad(90),math.rad(5),math.rad(0))) | |
| 293 | p = p:Clone() | |
| 294 | p.Parent = Model | |
| 295 | p.Mesh.Scale = Vector3.new(.1,.2,1)/.2 | |
| 296 | weld(ra,p,CFrame.new(.55,.975,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(5))) | |
| 297 | p = p:Clone() | |
| 298 | p.Parent = Model | |
| 299 | p.Mesh.Scale = Vector3.new(.1,.2,.9)/.2 | |
| 300 | weld(ra,p,CFrame.new(.54,1.095,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(5))) | |
| 301 | p = p:Clone() | |
| 302 | p.Parent = Model | |
| 303 | p.Mesh.Scale = Vector3.new(.1,.2,1)/.2 | |
| 304 | weld(ra,p,CFrame.new(-.34,1.025,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(5))) | |
| 305 | ||
| 306 | local p2 = p:Clone() | |
| 307 | p2.BrickColor = clr | |
| 308 | p2.Parent = Model | |
| 309 | p2.Mesh.Scale = Vector3.new(.1,1.35,.2)/.2 | |
| 310 | weld(ra,p2,CFrame.new(.5,-.35,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 311 | p2 = p2:Clone() | |
| 312 | p2.Parent = Model | |
| 313 | p2.Mesh.Scale = Vector3.new(.1,.5,.2)/.2 | |
| 314 | weld(ra,p2,CFrame.new(.499,0.055,-.145) * CFrame.Angles(math.rad(30),math.rad(0),math.rad(0))) | |
| 315 | p2 = p2:Clone() | |
| 316 | p2.Parent = Model | |
| 317 | p2.Mesh.Scale = Vector3.new(.1,.5,.2)/.2 | |
| 318 | weld(ra,p2,CFrame.new(.499,0.055,.145) * CFrame.Angles(math.rad(-30),math.rad(0),math.rad(0))) | |
| 319 | p2 = p2:Clone() | |
| 320 | p2.Parent = Model | |
| 321 | p2.Mesh.Scale = Vector3.new(.1,.905,.2)/.2 | |
| 322 | weld(ra,p2,CFrame.new(.498,-.569,-.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 323 | p2 = p2:Clone() | |
| 324 | p2.Parent = Model | |
| 325 | p2.Mesh.Scale = Vector3.new(.1,.905,.2)/.2 | |
| 326 | weld(ra,p2,CFrame.new(.498,-.569,.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 327 | p2 = p2:Clone() | |
| 328 | p2.Parent = Model | |
| 329 | p2.Mesh.Scale = Vector3.new(1.05,.1,.199)/.2 | |
| 330 | weld(ra,p2,CFrame.new(.0249,-1,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 331 | p2 = p2:Clone() | |
| 332 | p2.Parent = Model | |
| 333 | p2.Mesh.Scale = Vector3.new(1.05,.1,.199)/.2 | |
| 334 | weld(ra,p2,CFrame.new(.0235,-1,.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 335 | p2 = p2:Clone() | |
| 336 | p2.Parent = Model | |
| 337 | p2.Mesh.Scale = Vector3.new(1.05,.1,.199)/.2 | |
| 338 | weld(ra,p2,CFrame.new(.0235,-1,-.255) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 339 | p2 = p2:Clone() | |
| 340 | p2.Parent = Model | |
| 341 | p2.Mesh.Scale = Vector3.new(.7,.7,1.1)/.2 | |
| 342 | weld(ra,p2,CFrame.new(0,-.5,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 343 | ||
| 344 | p = p:Clone() | |
| 345 | p.Parent = Model | |
| 346 | p.Mesh.Scale = Vector3.new(1.05,1.05,1.05)/.2 | |
| 347 | weld(ra,p,CFrame.new(0,-.5,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 348 | ||
| 349 | ||
| 350 | p = part:Clone() | |
| 351 | p.Parent = Model | |
| 352 | p.Mesh.Scale = Vector3.new(1.01,1.01,1.01)/.2 | |
| 353 | weld(ra,p,CFrame.new(0,0.5,0)) | |
| 354 | local p3 = part:Clone() | |
| 355 | p3.Parent = Model | |
| 356 | p3.Mesh:Destroy() | |
| 357 | Instance.new("SpecialMesh",p3).MeshType = Enum.MeshType.Wedge
| |
| 358 | p3.Mesh.Scale = Vector3.new(1.05,1.05,1.21)/.2 | |
| 359 | weld(la,p3,CFrame.new(-.1,.5,0) * CFrame.Angles(math.rad(180),math.rad(90),math.rad(0))) | |
| 360 | p = p:Clone() | |
| 361 | p.Parent = Model | |
| 362 | p.Mesh:Destroy() | |
| 363 | p.BrickColor = BrickColor.new("Brick yellow")
| |
| 364 | Instance.new("SpecialMesh",p).MeshType = Enum.MeshType.Brick
| |
| 365 | p.Mesh.Scale = Vector3.new(1,2,1)/.2 | |
| 366 | weld(la,p,CFrame.new(0,0,0)) | |
| 367 | p = p:Clone() | |
| 368 | p.Parent = Model | |
| 369 | p.BrickColor = invcol(clr) | |
| 370 | p.Mesh.Scale = Vector3.new(1.05,1.5,1.04)/.2 | |
| 371 | weld(la,p,CFrame.new(0,.25,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 372 | ||
| 373 | p = part:Clone() | |
| 374 | p.BrickColor = invcol(clr) | |
| 375 | p.Parent = Model | |
| 376 | p.Mesh.Scale = Vector3.new(2.1,.2,1.099)/.2 | |
| 377 | weld(tar,p,CFrame.new(0,-.91,0)) | |
| 378 | p = p:Clone() | |
| 379 | p.Parent = Model | |
| 380 | p.Mesh.Scale = Vector3.new(.2,2.41,1.099)/.2 | |
| 381 | weld(tar,p,CFrame.new(0,0.05,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(40))) | |
| 382 | p = p:Clone() | |
| 383 | p.Parent = Model | |
| 384 | p.Mesh.Scale = Vector3.new(.1,.1,1.099)/.2 | |
| 385 | weld(tar,p,CFrame.new(-.8,.95,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 386 | ||
| 387 | p = part:Clone() | |
| 388 | p.Parent = Model | |
| 389 | p.Mesh.Scale = Vector3.new(2.003,2.003,1.003)/.2 | |
| 390 | weld(tar,p,CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 391 | ||
| 392 | p = p:Clone() | |
| 393 | p.Parent = Model | |
| 394 | p.Mesh.Scale = Vector3.new(1.003,2.003,1.003)/.2 | |
| 395 | weld(ll,p,CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 396 | p = p:Clone() | |
| 397 | p.Parent = Model | |
| 398 | p.Mesh.Scale = Vector3.new(1.003,2.003,1.003)/.2 | |
| 399 | weld(rl,p,CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))) | |
| 400 | end | |
| 401 | ||
| 402 | local Main = part:Clone() | |
| 403 | Main.Parent = Model | |
| 404 | Main.Mesh.Scale = Vector3.new(startWidth/.2,thickness/Main.Size.Y,zSiz/Main.Size.X) | |
| 405 | Main:BreakJoints() | |
| 406 | ||
| 407 | local M1 = Instance.new("Motor6D")
| |
| 408 | M1.MaxVelocity = 0 | |
| 409 | M1.Part0 = tar | |
| 410 | M1.Part1 = Main | |
| 411 | M1.C0 = CFrame.new(0,1,.5) * CFrame.Angles(0,math.pi/2,0) | |
| 412 | M1.C1 = CFrame.new(0,0,-zSiz/2) * CFrame.Angles(0,math.pi/2,0) | |
| 413 | M1.Parent = Model | |
| 414 | --[[ | |
| 415 | local p2 = Main:Clone() | |
| 416 | p2.Parent = Model | |
| 417 | p2.Size = Vector3.new(.2,p2.Size.X,.2) | |
| 418 | p2.Mesh:Destroy() | |
| 419 | Instance.new("CylinderMesh",p2).Scale = Vector3.new(1,.99,1)
| |
| 420 | local W = Instance.new("Weld",Model)
| |
| 421 | W.Part0 = Main | |
| 422 | W.Part1 = p2 | |
| 423 | W.C0 = CFrame.new(0,0,-zSiz/2) * CFrame.Angles(0,0,math.pi/2)]] | |
| 424 | local last = Main | |
| 425 | ||
| 426 | for i=1,partAm-1 do | |
| 427 | local p = Main:Clone() | |
| 428 | p.Parent = Model | |
| 429 | local sz = widthCh*i/.2 | |
| 430 | p.Mesh.Scale = Vector3.new(p.Mesh.Scale.X + sz,p.Mesh.Scale.Y,p.Mesh.Scale.Z) | |
| 431 | p:BreakJoints() | |
| 432 | local M = M1:Clone() | |
| 433 | M.C0 = CFrame.new(0,0,zSiz/2) * CFrame.Angles(0,math.pi/2,0) | |
| 434 | M.Part0 = last | |
| 435 | M.Part1 = p | |
| 436 | M.Parent = Model | |
| 437 | ||
| 438 | table.insert(Parts,{p = M, l = 0, an = 0})
| |
| 439 | last = p | |
| 440 | end | |
| 441 | ||
| 442 | function Lerp(start,goal,alpha) | |
| 443 | return start* (1-alpha) + goal*alpha | |
| 444 | end | |
| 445 | ||
| 446 | local mode = "idle" | |
| 447 | ||
| 448 | function getForwardSpeed() | |
| 449 | local FwVec = tar.Velocity * tar.CFrame.lookVector | |
| 450 | FwVec = Vector3.new(FwVec.X > -0.05 and FwVec.X or 0, 0, FwVec.Z > -0.05 and FwVec.Z or 0) | |
| 451 | return FwVec.X + FwVec.Z | |
| 452 | end | |
| 453 | ||
| 454 | function getBackwardSpeed() | |
| 455 | local BwVec = tar.Velocity * tar.CFrame.lookVector | |
| 456 | BwVec = Vector3.new(BwVec.X < 0.05 and BwVec.X or 0, 0, BwVec.Z < 0.05 and BwVec.Z or 0) | |
| 457 | return BwVec.X + BwVec.Z | |
| 458 | end | |
| 459 | ||
| 460 | function getMainAlpha() | |
| 461 | return .2 | |
| 462 | end | |
| 463 | ||
| 464 | function getAngle() | |
| 465 | if mode == "run" then return math.max(0.1,math.min(2-(getForwardSpeed()/16)^0.50,1)) end | |
| 466 | if mode == "jump" then return 1.55 end | |
| 467 | if mode == "fall" then return -1.2 end | |
| 468 | if mode == "moonwalk" then return 1.50 end | |
| 469 | return 1.55 | |
| 470 | end | |
| 471 | ||
| 472 | function getWaveAm() | |
| 473 | if mode == "run" then return 1 end | |
| 474 | if mode == "jump" then return 3 end | |
| 475 | if mode == "fall" then return 1 end | |
| 476 | if mode == "moonwalk" then return 1 end | |
| 477 | return .1 | |
| 478 | end | |
| 479 | ||
| 480 | function getWaveSize() | |
| 481 | if mode == "run" then return .1 end | |
| 482 | if mode == "jump" then return .1 end | |
| 483 | if mode == "fall" then return .1 end | |
| 484 | if mode == "moonwalk" then return .01 end | |
| 485 | return math.rad(1) | |
| 486 | end | |
| 487 | ||
| 488 | while Model ~= nil and Model.Parent ~= nil and tar ~= nil and not closeall do | |
| 489 | local verVel = tar.CFrame:vectorToObjectSpace(tar.Velocity).Y | |
| 490 | if verVel < -5 then | |
| 491 | mode = "fall" | |
| 492 | elseif verVel > 5 then | |
| 493 | mode = "jump" | |
| 494 | else | |
| 495 | if getForwardSpeed() > 0 or getBackwardSpeed() > 0 then | |
| 496 | if getForwardSpeed() > char.Humanoid.WalkSpeed/2 then | |
| 497 | mode = "run" | |
| 498 | else | |
| 499 | mode = "moonwalk" | |
| 500 | end | |
| 501 | else | |
| 502 | mode = "idle" | |
| 503 | end | |
| 504 | end | |
| 505 | local wave = (math.abs((tick() % (1/getWaveAm()))-(1/getWaveAm()/2)) - (1/getWaveAm()/2)) *(getWaveAm()*getWaveSize()) | |
| 506 | ||
| 507 | M1.CurrentAngle = Lerp(M1.CurrentAngle,getAngle(),.2)+wave -- .2 = 50 | |
| 508 | ||
| 509 | local an = M1.CurrentAngle | |
| 510 | local blkd = false | |
| 511 | local blkan = 0 | |
| 512 | for i,v in pairs(Parts) do | |
| 513 | ||
| 514 | local ang = Lerp((v.an-an),0,0.4 + (0.05*(partAm/10))) -- .7 = 50 | |
| 515 | v.p.CurrentAngle = ang | |
| 516 | ||
| 517 | if capeLength > 4 and phys then | |
| 518 | local part0 = v.p.Part0 | |
| 519 | local part1 = v.p.Part1 | |
| 520 | local x = part0.Mesh.Scale.X*.2 | |
| 521 | local lblkd = false | |
| 522 | local am = 3 | |
| 523 | for a=1,am do | |
| 524 | local pos0 = (part0.CFrame * CFrame.new(-x/2+x/am*a,0,0)).p + Vector3.new(0,thickness,0) | |
| 525 | local pos1= (part1.CFrame * CFrame.new(-x/2+x/am*a,0,0)).p - Vector3.new(0,thickness,0) | |
| 526 | local hit,ray = workspace:FindPartOnRayWithIgnoreList(Ray.new(pos0,(pos1-pos0).unit*(pos0-pos1).magnitude),{Model,workspace.CurrentCamera,char})
| |
| 527 | if hit and hit.CanCollide then | |
| 528 | lblkd = true | |
| 529 | break | |
| 530 | end | |
| 531 | end | |
| 532 | if blkd and not lblkd then | |
| 533 | ang = 1.55--blkan | |
| 534 | elseif lblkd then | |
| 535 | if not blkd then | |
| 536 | ang = -an | |
| 537 | blkan = an | |
| 538 | end | |
| 539 | end | |
| 540 | blkd = lblkd | |
| 541 | ||
| 542 | v.p.CurrentAngle = ang | |
| 543 | end | |
| 544 | ||
| 545 | v.an = an | |
| 546 | an = an + ang | |
| 547 | end | |
| 548 | ||
| 549 | ||
| 550 | wait(1/ups) | |
| 551 | if not Model:IsDescendantOf(workspace) then break end | |
| 552 | end |