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 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
| 122 | g.service = g.GetService | |
| 123 | ||
| 124 | g.RunService = FakeService({
| |
| 125 | RenderStepped = _rg:GetService("RunService").Heartbeat,
| |
| 126 | BindToRenderStep = function(self,name,_,fun) | |
| 127 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 128 | end, | |
| 129 | UnbindFromRenderStep = function(self,name) | |
| 130 | self._btrs[name]:Disconnect() | |
| 131 | end, | |
| 132 | },"RunService") | |
| 133 | ||
| 134 | setmetatable(g,{
| |
| 135 | __index=function(self,s) | |
| 136 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
| 137 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
| 138 | end, | |
| 139 | __newindex = fsmt.__newindex, | |
| 140 | __call = fsmt.__call | |
| 141 | }) | |
| 142 | --Changing owner to fake player object to support owner:GetMouse() | |
| 143 | game,owner = g,g.Players.LocalPlayer | |
| 144 | end | |
| 145 | ||
| 146 | ||
| 147 | -- Press X where you wanna sit | |
| 148 | ||
| 149 | ||
| 150 | local plr = game:service'Players'.LocalPlayer | |
| 151 | ||
| 152 | local m = plr:GetMouse() | |
| 153 | ||
| 154 | local char = plr.Character | |
| 155 | ||
| 156 | local hed = plr.Character.Head | |
| 157 | ||
| 158 | local runservice = game:service'RunService' | |
| 159 | ||
| 160 | local modelScale = 1/5 | |
| 161 | ||
| 162 | plr.Chatted:connect(function(msg) | |
| 163 | game:service'Chat':Chat(hed, msg, 1) | |
| 164 | if msg == "die/" then | |
| 165 | char:breakJoints() | |
| 166 | end | |
| 167 | ||
| 168 | end) | |
| 169 | ||
| 170 | ||
| 171 | pcall(function() local a = script.Parent.FaerieScript if a ~= script then a:Destroy() end end) | |
| 172 | ||
| 173 | pcall(function() local a = char.Animate if a ~= script then a.Disabled = true a:Destroy() end end) | |
| 174 | ||
| 175 | script.Name = "FaerieScript" | |
| 176 | ||
| 177 | ||
| 178 | function weld(a,b,c,d) | |
| 179 | ||
| 180 | local w = Instance.new("Weld",a)
| |
| 181 | ||
| 182 | w.Part0 = a | |
| 183 | ||
| 184 | w.Part1 = b | |
| 185 | ||
| 186 | w.C0 = c or CFrame.new() | |
| 187 | ||
| 188 | w.C1 = d or CFrame.new() | |
| 189 | ||
| 190 | return w | |
| 191 | ||
| 192 | end | |
| 193 | ||
| 194 | ||
| 195 | function lerp(a,b,c) | |
| 196 | ||
| 197 | return a+(b-a)*c | |
| 198 | ||
| 199 | end | |
| 200 | ||
| 201 | ||
| 202 | do -- Ignore my clerp stuff stolen from stravvy | |
| 203 | ||
| 204 | local function QuaternionFromCFrame(cf) | |
| 205 | ||
| 206 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() | |
| 207 | ||
| 208 | local trace = m00 + m11 + m22 | |
| 209 | ||
| 210 | if trace > 0 then | |
| 211 | ||
| 212 | local s = math.sqrt(1 + trace) | |
| 213 | ||
| 214 | local recip = 0.5/s | |
| 215 | ||
| 216 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 | |
| 217 | ||
| 218 | else | |
| 219 | ||
| 220 | local i = 0 | |
| 221 | ||
| 222 | if m11 > m00 then | |
| 223 | ||
| 224 | i = 1 | |
| 225 | ||
| 226 | end | |
| 227 | ||
| 228 | if m22 > (i == 0 and m00 or m11) then | |
| 229 | ||
| 230 | i = 2 | |
| 231 | ||
| 232 | end | |
| 233 | ||
| 234 | if i == 0 then | |
| 235 | ||
| 236 | local s = math.sqrt(m00-m11-m22+1) | |
| 237 | ||
| 238 | local recip = 0.5/s | |
| 239 | ||
| 240 | return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip | |
| 241 | ||
| 242 | elseif i == 1 then | |
| 243 | ||
| 244 | local s = math.sqrt(m11-m22-m00+1) | |
| 245 | ||
| 246 | local recip = 0.5/s | |
| 247 | ||
| 248 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip | |
| 249 | ||
| 250 | elseif i == 2 then | |
| 251 | ||
| 252 | local s = math.sqrt(m22-m00-m11+1) | |
| 253 | ||
| 254 | local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip | |
| 255 | ||
| 256 | end | |
| 257 | ||
| 258 | end | |
| 259 | ||
| 260 | end | |
| 261 | ||
| 262 | local function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
| 263 | ||
| 264 | local xs, ys, zs = x + x, y + y, z + z | |
| 265 | ||
| 266 | local wx, wy, wz = w*xs, w*ys, w*zs | |
| 267 | ||
| 268 | local xx = x*xs | |
| 269 | ||
| 270 | local xy = x*ys | |
| 271 | ||
| 272 | local xz = x*zs | |
| 273 | ||
| 274 | local yy = y*ys | |
| 275 | ||
| 276 | local yz = y*zs | |
| 277 | ||
| 278 | local zz = z*zs | |
| 279 | ||
| 280 | return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) | |
| 281 | ||
| 282 | end | |
| 283 | ||
| 284 | local function QuaternionSlerp(a, b, t) | |
| 285 | ||
| 286 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] | |
| 287 | ||
| 288 | local startInterp, finishInterp; | |
| 289 | ||
| 290 | if cosTheta >= 0.0001 then | |
| 291 | ||
| 292 | if (1 - cosTheta) > 0.0001 then | |
| 293 | ||
| 294 | local theta = math.acos(cosTheta) | |
| 295 | ||
| 296 | local invSinTheta = 1/math.sin(theta) | |
| 297 | ||
| 298 | startInterp = math.sin((1-t)*theta)*invSinTheta | |
| 299 | ||
| 300 | finishInterp = math.sin(t*theta)*invSinTheta | |
| 301 | ||
| 302 | else | |
| 303 | ||
| 304 | startInterp = 1-t | |
| 305 | ||
| 306 | finishInterp = t | |
| 307 | ||
| 308 | end | |
| 309 | ||
| 310 | else | |
| 311 | ||
| 312 | if (1+cosTheta) > 0.0001 then | |
| 313 | ||
| 314 | local theta = math.acos(-cosTheta) | |
| 315 | ||
| 316 | local invSinTheta = 1/math.sin(theta) | |
| 317 | ||
| 318 | startInterp = math.sin((t-1)*theta)*invSinTheta | |
| 319 | ||
| 320 | finishInterp = math.sin(t*theta)*invSinTheta | |
| 321 | ||
| 322 | else | |
| 323 | ||
| 324 | startInterp = t-1 | |
| 325 | ||
| 326 | finishInterp = t | |
| 327 | ||
| 328 | end | |
| 329 | ||
| 330 | end | |
| 331 | ||
| 332 | return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp | |
| 333 | ||
| 334 | end | |
| 335 | ||
| 336 | function clerp(a,b,t) | |
| 337 | ||
| 338 | local qa = {QuaternionFromCFrame(a)}
| |
| 339 | ||
| 340 | local qb = {QuaternionFromCFrame(b)}
| |
| 341 | ||
| 342 | local ax, ay, az = a.x, a.y, a.z | |
| 343 | ||
| 344 | local bx, by, bz = b.x, b.y, b.z | |
| 345 | ||
| 346 | local _t = 1-t | |
| 347 | ||
| 348 | return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t)) | |
| 349 | ||
| 350 | end | |
| 351 | ||
| 352 | end | |
| 353 | ||
| 354 | ||
| 355 | for i,v in pairs(char:GetChildren()) do | |
| 356 | ||
| 357 | if v:IsA("Hat") or v:IsA("BodyColors") or v:IsA("Clothing") or v:IsA("ShirtGraphic") then
| |
| 358 | ||
| 359 | v:Destroy() | |
| 360 | ||
| 361 | end | |
| 362 | ||
| 363 | end | |
| 364 | ||
| 365 | Instance.new("Hat",char)
| |
| 366 | ||
| 367 | local root = char.HumanoidRootPart | |
| 368 | ||
| 369 | local tw = root.RootJoint | |
| 370 | ||
| 371 | local tor = char.Torso | |
| 372 | ||
| 373 | local hd = char.Head | |
| 374 | ||
| 375 | local hum = char.Humanoid | |
| 376 | ||
| 377 | hum.Health = 40 | |
| 378 | ||
| 379 | hum.MaxHealth = 40 | |
| 380 | ||
| 381 | hum.WalkSpeed = 12 | |
| 382 | ||
| 383 | local rl,ll = char["Right Leg"],char["Left Leg"] | |
| 384 | ||
| 385 | local ra,la = char["Right Arm"],char["Left Arm"] | |
| 386 | ||
| 387 | ||
| 388 | local c0 = {
| |
| 389 | ||
| 390 | rs = CFrame.new(1,.5,0), | |
| 391 | ||
| 392 | ls = CFrame.new(-1,.5,0), | |
| 393 | ||
| 394 | rh = CFrame.new(.5,-1,0), | |
| 395 | ||
| 396 | lh = CFrame.new(-.5,-1,0), | |
| 397 | ||
| 398 | nk = CFrame.new(0,1,0), | |
| 399 | ||
| 400 | tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0), | |
| 401 | ||
| 402 | } | |
| 403 | ||
| 404 | local c1 = {
| |
| 405 | ||
| 406 | rs = CFrame.new(-.5,.5,0), | |
| 407 | ||
| 408 | ls = CFrame.new(.5,.5,0), | |
| 409 | ||
| 410 | rh = CFrame.new(0,1,0), | |
| 411 | ||
| 412 | lh = CFrame.new(0,1,0), | |
| 413 | ||
| 414 | nk = CFrame.new(0,-.5,0), | |
| 415 | ||
| 416 | tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) | |
| 417 | ||
| 418 | } | |
| 419 | ||
| 420 | ||
| 421 | local rs = tor["Right Shoulder"] | |
| 422 | ||
| 423 | local ls = tor["Left Shoulder"] | |
| 424 | ||
| 425 | local rh = tor["Right Hip"] | |
| 426 | ||
| 427 | local lh = tor["Left Hip"] | |
| 428 | ||
| 429 | local nk = tor["Neck"] | |
| 430 | ||
| 431 | for i,v in pairs(tor:GetChildren()) do | |
| 432 | ||
| 433 | if v:IsA("Motor6D") then
| |
| 434 | ||
| 435 | v.DesiredAngle = 0 | |
| 436 | ||
| 437 | v.MaxVelocity = 0 | |
| 438 | ||
| 439 | v.CurrentAngle = 0 | |
| 440 | ||
| 441 | end | |
| 442 | ||
| 443 | end | |
| 444 | ||
| 445 | ||
| 446 | ||
| 447 | ||
| 448 | ||
| 449 | pcall(function() tor.roblox:Destroy() end) | |
| 450 | ||
| 451 | ||
| 452 | pcall(function() char.Faerie:Destroy() end) | |
| 453 | ||
| 454 | local model = Instance.new("Model",char)
| |
| 455 | ||
| 456 | model.Name = "Faerie" | |
| 457 | ||
| 458 | ||
| 459 | local BasePart = Instance.new("Part")
| |
| 460 | ||
| 461 | BasePart.CanCollide = false | |
| 462 | ||
| 463 | BasePart.Anchored = false | |
| 464 | ||
| 465 | BasePart.FormFactor = "Custom" | |
| 466 | ||
| 467 | BasePart.Locked = true | |
| 468 | ||
| 469 | BasePart.Size = Vector3.new() | |
| 470 | ||
| 471 | BasePart.TopSurface,BasePart.BottomSurface,BasePart.LeftSurface,BasePart.RightSurface,BasePart.FrontSurface,BasePart.BackSurface = 10,10,10,10,10,10 | |
| 472 | ||
| 473 | BasePart:BreakJoints() | |
| 474 | ||
| 475 | ||
| 476 | function NP(par) | |
| 477 | ||
| 478 | local p = BasePart:Clone() | |
| 479 | ||
| 480 | p.Parent = par or model | |
| 481 | ||
| 482 | return p | |
| 483 | ||
| 484 | end | |
| 485 | ||
| 486 | ||
| 487 | local w1 = NP() | |
| 488 | ||
| 489 | w1.Transparency = .1 | |
| 490 | ||
| 491 | local w1m = Instance.new("SpecialMesh",w1)
| |
| 492 | ||
| 493 | w1m.MeshId = "rbxassetid://19367766" | |
| 494 | ||
| 495 | w1m.TextureId = "rbxassetid://9854798" | |
| 496 | ||
| 497 | w1m.Scale = Vector3.new(1.05, 1.05, 1.05) | |
| 498 | ||
| 499 | local w1 = weld(tor,w1,CFrame.new(-.1,0.55,1.6)) | |
| 500 | ||
| 501 | ||
| 502 | local w2 = NP() | |
| 503 | ||
| 504 | w2.Transparency = .1 | |
| 505 | ||
| 506 | local w2m = Instance.new("SpecialMesh",w2)
| |
| 507 | ||
| 508 | w2m.MeshId = "rbxassetid://19367766" | |
| 509 | ||
| 510 | w2m.TextureId = "rbxassetid://9854798" | |
| 511 | ||
| 512 | w2m.Scale = Vector3.new(1.05, 1.05, 1.05) | |
| 513 | ||
| 514 | local w2 = weld(tor,w2,CFrame.new(.1,0.55,1.6)) | |
| 515 | ||
| 516 | ||
| 517 | local h = NP() | |
| 518 | ||
| 519 | local hm = Instance.new("SpecialMesh",h)
| |
| 520 | ||
| 521 | hm.MeshId = "rbxassetid://154820214" | |
| 522 | ||
| 523 | hm.TextureId = "rbxassetid://91740209" | |
| 524 | ||
| 525 | hm.Scale = Vector3.new(1, 1, 1) | |
| 526 | ||
| 527 | weld(hd,h,CFrame.new(0,0.2,0)) | |
| 528 | ||
| 529 | ||
| 530 | for i,v in pairs(char:GetChildren()) do | |
| 531 | ||
| 532 | if v:IsA("BasePart") then
| |
| 533 | ||
| 534 | v.Material = "SmoothPlastic" | |
| 535 | ||
| 536 | v.TopSurface,v.BottomSurface,v.FrontSurface,v.BackSurface,v.LeftSurface,v.RightSurface = 10,10,10,10,10,10 | |
| 537 | ||
| 538 | end | |
| 539 | ||
| 540 | end | |
| 541 | ||
| 542 | ||
| 543 | do | |
| 544 | ||
| 545 | if modelScale ~= 1 then | |
| 546 | ||
| 547 | for i,v in pairs(c0) do | |
| 548 | ||
| 549 | c0[i] = (v-v.p) + v.p*modelScale | |
| 550 | ||
| 551 | end | |
| 552 | ||
| 553 | for i,v in pairs(c1) do | |
| 554 | ||
| 555 | c1[i] = (v-v.p) + v.p*modelScale | |
| 556 | ||
| 557 | end | |
| 558 | ||
| 559 | local Joints = {}
| |
| 560 | ||
| 561 | local gtJoints,gtParts; | |
| 562 | ||
| 563 | ||
| 564 | local function gtCFrame(cf) | |
| 565 | ||
| 566 | return (cf-cf.p) + cf.p * modelScale | |
| 567 | ||
| 568 | end | |
| 569 | ||
| 570 | ||
| 571 | function gtJoints(p) | |
| 572 | ||
| 573 | for i,v in pairs(p:GetChildren()) do | |
| 574 | ||
| 575 | if v:IsA("JointInstance") then
| |
| 576 | ||
| 577 | table.insert(Joints,{v,v.Part0,v.Part1})
| |
| 578 | ||
| 579 | v.Part0 = nil | |
| 580 | ||
| 581 | v.Part1 = nil | |
| 582 | ||
| 583 | v.C0 = (v.C0-(v.C0.p)) + (v.C0.p * modelScale) | |
| 584 | ||
| 585 | v.C1 = (v.C1-(v.C1.p)) + (v.C1.p * modelScale) | |
| 586 | ||
| 587 | end | |
| 588 | ||
| 589 | gtJoints(v) | |
| 590 | ||
| 591 | end | |
| 592 | ||
| 593 | end | |
| 594 | ||
| 595 | ||
| 596 | function gtParts(p) | |
| 597 | ||
| 598 | for i,v in pairs(p:GetChildren()) do | |
| 599 | ||
| 600 | if v:IsA("BasePart") then
| |
| 601 | ||
| 602 | pcall(function() v.FormFactor = "Custom" end) | |
| 603 | ||
| 604 | local oldz = v.Size | |
| 605 | ||
| 606 | local cf = tor.CFrame:toObjectSpace(v.CFrame) | |
| 607 | ||
| 608 | v.Size = v.Size * modelScale | |
| 609 | ||
| 610 | v.CFrame = tor.CFrame * gtCFrame(cf) | |
| 611 | ||
| 612 | local mesh = nil | |
| 613 | ||
| 614 | for i,t in pairs(v:GetChildren()) do | |
| 615 | ||
| 616 | if t:IsA("DataModelMesh") then
| |
| 617 | ||
| 618 | mesh = t | |
| 619 | ||
| 620 | end | |
| 621 | ||
| 622 | end | |
| 623 | ||
| 624 | if mesh == nil and v:IsA("Part") and v.Shape == Enum.PartType.Ball then
| |
| 625 | ||
| 626 | mesh = Instance.new("SpecialMesh",v)
| |
| 627 | ||
| 628 | mesh.MeshType = Enum.MeshType.Sphere | |
| 629 | ||
| 630 | end | |
| 631 | ||
| 632 | if mesh == nil and ((v:IsA("Part") and v.Shape == Enum.PartType.Block) or v:IsA("Seat") or v:IsA("VehicleSeat")) then
| |
| 633 | ||
| 634 | mesh = Instance.new("BlockMesh",v)
| |
| 635 | ||
| 636 | end | |
| 637 | ||
| 638 | if mesh ~= nil then | |
| 639 | ||
| 640 | if mesh:IsA("SpecialMesh") and mesh.MeshType == Enum.MeshType.FileMesh then
| |
| 641 | ||
| 642 | mesh.Scale = mesh.Scale * modelScale | |
| 643 | ||
| 644 | else | |
| 645 | ||
| 646 | mesh.Scale = mesh.Scale*(oldz*modelScale)/v.Size | |
| 647 | ||
| 648 | end | |
| 649 | ||
| 650 | end | |
| 651 | ||
| 652 | end | |
| 653 | ||
| 654 | gtParts(v) | |
| 655 | ||
| 656 | end | |
| 657 | ||
| 658 | end | |
| 659 | ||
| 660 | gtJoints(char) | |
| 661 | ||
| 662 | gtParts(char) | |
| 663 | ||
| 664 | for i,v in pairs(Joints) do | |
| 665 | ||
| 666 | v[1].Part0 = v[2] | |
| 667 | ||
| 668 | v[1].Part1 = v[3] | |
| 669 | ||
| 670 | end | |
| 671 | ||
| 672 | end | |
| 673 | ||
| 674 | end | |
| 675 | ||
| 676 | rs.C0,rs.C1 = c0.rs,c1.rs | |
| 677 | ||
| 678 | ls.C0,ls.C1 = c0.ls,c1.ls | |
| 679 | ||
| 680 | rh.C0,rh.C1 = c0.rh,c1.rh | |
| 681 | ||
| 682 | lh.C0,lh.C1 = c0.lh,c1.lh | |
| 683 | ||
| 684 | nk.C0,nk.C1 = c0.nk,c1.nk | |
| 685 | ||
| 686 | tw.C0,tw.C1 = c0.tw,c1.tw | |
| 687 | ||
| 688 | ||
| 689 | local w10,w20 = w1.C0,w2.C0 | |
| 690 | ||
| 691 | ||
| 692 | local pl = tor:FindFirstChild("FairyLight") or Instance.new("PointLight",tor)
| |
| 693 | ||
| 694 | pl.Name = "FairyLight" | |
| 695 | ||
| 696 | pl.Shadows = false | |
| 697 | ||
| 698 | pl.Range = 8 | |
| 699 | ||
| 700 | pl.Brightness = 10 | |
| 701 | ||
| 702 | ||
| 703 | local sparkles = tor:FindFirstChild("FairySparkles") or Instance.new("Sparkles",tor)
| |
| 704 | ||
| 705 | sparkles.Name = "FairySparkles" | |
| 706 | ||
| 707 | ||
| 708 | ||
| 709 | local outfit = 0 | |
| 710 | ||
| 711 | local outfitparts = {ra,la,rl,ll,tor}
| |
| 712 | ||
| 713 | local outfits = {
| |
| 714 | ||
| 715 | {{106705109},{106705077},{106703301},{106703213},{106705037}}
| |
| 716 | ||
| 717 | } | |
| 718 | ||
| 719 | ||
| 720 | ||
| 721 | local mycolor = ll.BrickColor.Color | |
| 722 | ||
| 723 | local mycolor2 = mycolor | |
| 724 | ||
| 725 | ||
| 726 | function setOutfit() | |
| 727 | ||
| 728 | local of = outfits[outfit] | |
| 729 | ||
| 730 | if of then | |
| 731 | ||
| 732 | for i,v in pairs(outfitparts) do | |
| 733 | ||
| 734 | local mesh = v:FindFirstChild("outfitMesh")
| |
| 735 | ||
| 736 | local meshdata = outfits[outfit][i] | |
| 737 | ||
| 738 | if not mesh then | |
| 739 | ||
| 740 | mesh = Instance.new("SpecialMesh",v)
| |
| 741 | ||
| 742 | mesh.Name = "outfitMesh" | |
| 743 | ||
| 744 | mesh.TextureId = "rbxassetid://9854798" | |
| 745 | ||
| 746 | end | |
| 747 | ||
| 748 | mesh.Scale =(meshdata[2] or Vector3.new(1,1,1)) * modelScale | |
| 749 | ||
| 750 | mesh.MeshId = "rbxassetid://"..meshdata[1] | |
| 751 | ||
| 752 | mesh.VertexColor = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b) | |
| 753 | ||
| 754 | end | |
| 755 | ||
| 756 | else | |
| 757 | ||
| 758 | for i,v in pairs(outfitparts) do | |
| 759 | ||
| 760 | pcall(function() v.outfitMesh:Destroy() end) | |
| 761 | ||
| 762 | end | |
| 763 | ||
| 764 | end | |
| 765 | ||
| 766 | end | |
| 767 | ||
| 768 | setOutfit() | |
| 769 | ||
| 770 | ||
| 771 | local senabled = true | |
| 772 | ||
| 773 | local lenabled = true | |
| 774 | ||
| 775 | function changeColor() | |
| 776 | ||
| 777 | for i,v in pairs(char:GetChildren()) do | |
| 778 | ||
| 779 | if v:IsA("BasePart") then
| |
| 780 | ||
| 781 | v.BrickColor = BrickColor.new(mycolor) | |
| 782 | ||
| 783 | end | |
| 784 | ||
| 785 | end | |
| 786 | ||
| 787 | local mc1 = Vector3.new(mycolor.r,mycolor.g,mycolor.b) | |
| 788 | ||
| 789 | local mc2 = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b) | |
| 790 | ||
| 791 | w1m.VertexColor,w2m.VertexColor,hm.VertexColor = mc1,mc1,mc2 | |
| 792 | ||
| 793 | for i,v in pairs(outfitparts) do | |
| 794 | ||
| 795 | local mesh = v:FindFirstChild("outfitMesh")
| |
| 796 | ||
| 797 | if mesh then | |
| 798 | ||
| 799 | mesh.VertexColor = mc2 | |
| 800 | ||
| 801 | end | |
| 802 | ||
| 803 | end | |
| 804 | ||
| 805 | pl.Color = mycolor | |
| 806 | ||
| 807 | sparkles.SparkleColor = mycolor | |
| 808 | ||
| 809 | end | |
| 810 | ||
| 811 | changeColor() | |
| 812 | ||
| 813 | ||
| 814 | do | |
| 815 | ||
| 816 | pcall(function() plr.PlayerGui.fairyColoring:Destroy() end) | |
| 817 | ||
| 818 | local scr = Instance.new("ScreenGui",plr.PlayerGui)
| |
| 819 | ||
| 820 | scr.Name = "fairyColoring" | |
| 821 | ||
| 822 | local fr = Instance.new("Frame",scr)
| |
| 823 | ||
| 824 | fr.Size = UDim2.new(0,-150,0,-65) | |
| 825 | ||
| 826 | fr.BackgroundColor3 = Color3.new(1,1,1) | |
| 827 | ||
| 828 | fr.BorderColor3 = Color3.new(.05,.05,.05) | |
| 829 | ||
| 830 | fr.BackgroundTransparency = .8 | |
| 831 | ||
| 832 | fr.Position = UDim2.new(1,0,1,scr.Parent:FindFirstChild("PandaHelpNotify") and -20 or 0)
| |
| 833 | ||
| 834 | fr.ZIndex = 9 | |
| 835 | ||
| 836 | local am = 75 | |
| 837 | ||
| 838 | local rval,gval,bval = mycolor.r,mycolor.g,mycolor.b | |
| 839 | ||
| 840 | local r = Instance.new("TextButton",fr)
| |
| 841 | ||
| 842 | r.BackgroundTransparency = 1 | |
| 843 | ||
| 844 | r.Size = UDim2.new(0,75,0,15) | |
| 845 | ||
| 846 | r.Position = UDim2.new(0,5,0,5) | |
| 847 | ||
| 848 | r.TextColor3 = Color3.new(1,1,1) | |
| 849 | ||
| 850 | r.TextStrokeTransparency = .4 | |
| 851 | ||
| 852 | for i=1,am do | |
| 853 | ||
| 854 | local t = Instance.new("ImageLabel",r)
| |
| 855 | ||
| 856 | t.BorderSizePixel = 0 | |
| 857 | ||
| 858 | t.Size = UDim2.new(1/am,0,1,0) | |
| 859 | ||
| 860 | t.Position = UDim2.new((i-1)/am,0,0,0) | |
| 861 | ||
| 862 | t.Name = i | |
| 863 | ||
| 864 | t.ZIndex = 10 | |
| 865 | ||
| 866 | end | |
| 867 | ||
| 868 | local rb = Instance.new("ImageLabel",r)
| |
| 869 | ||
| 870 | rb.ZIndex = 10 | |
| 871 | ||
| 872 | rb.Size = UDim2.new(0,2,1,-2) | |
| 873 | ||
| 874 | rb.BackgroundColor3 = Color3.new(0,0,0) | |
| 875 | ||
| 876 | rb.BackgroundTransparency = .5 | |
| 877 | ||
| 878 | rb.BorderColor3 = Color3.new(.4,.4,.4) | |
| 879 | ||
| 880 | rb.Name = "b" | |
| 881 | ||
| 882 | local g = r:Clone() | |
| 883 | ||
| 884 | g.Parent = fr | |
| 885 | ||
| 886 | g.Position = UDim2.new(0,5,0,25) | |
| 887 | ||
| 888 | local b = r:Clone() | |
| 889 | ||
| 890 | b.Parent = fr | |
| 891 | ||
| 892 | b.Position = UDim2.new(0,5,0,45) | |
| 893 | ||
| 894 | r.ZIndex,g.ZIndex,b.ZIndex = 10,10,10 | |
| 895 | ||
| 896 | local prev = Instance.new("TextButton",fr)
| |
| 897 | ||
| 898 | prev.Size = UDim2.new(0,55,0,45) | |
| 899 | ||
| 900 | prev.Position = UDim2.new(0,90,0,5) | |
| 901 | ||
| 902 | prev.ZIndex = 10 | |
| 903 | ||
| 904 | prev.BorderColor3 = Color3.new(.2,.2,.2) | |
| 905 | ||
| 906 | prev.TextColor3 = Color3.new(1,1,1) | |
| 907 | ||
| 908 | prev.TextStrokeTransparency = .4 | |
| 909 | ||
| 910 | prev.TextYAlignment = "Bottom" | |
| 911 | ||
| 912 | prev.FontSize = "Size8" | |
| 913 | ||
| 914 | prev.TextWrapped = true | |
| 915 | ||
| 916 | local res = Instance.new("TextButton",fr)
| |
| 917 | ||
| 918 | res.Size = UDim2.new(0,55,0,9) | |
| 919 | ||
| 920 | res.Position = UDim2.new(0,90,0,51) | |
| 921 | ||
| 922 | res.ZIndex = 10 | |
| 923 | ||
| 924 | res.BorderColor3 = Color3.new(.2,.2,.2) | |
| 925 | ||
| 926 | res.BackgroundColor3 = Color3.new(.5,0,0) | |
| 927 | ||
| 928 | res.TextColor3 = Color3.new(1,1,1) | |
| 929 | ||
| 930 | res.Text = "reset" | |
| 931 | ||
| 932 | res.FontSize = "Size8" | |
| 933 | ||
| 934 | local mode = 0 | |
| 935 | ||
| 936 | local function update(set) | |
| 937 | ||
| 938 | r.b.Position = UDim2.new(rval,-1,0,1) | |
| 939 | ||
| 940 | g.b.Position = UDim2.new(gval,-1,0,1) | |
| 941 | ||
| 942 | b.b.Position = UDim2.new(bval,-1,0,1) | |
| 943 | ||
| 944 | local col = Color3.new(rval,gval,bval) | |
| 945 | ||
| 946 | prev.BackgroundColor3 = mode == 1 and mycolor2 or mycolor | |
| 947 | ||
| 948 | prev.Text = "" | |
| 949 | ||
| 950 | r.Text = math.floor(rval*255+.5) | |
| 951 | ||
| 952 | g.Text = math.floor(gval*255+.5) | |
| 953 | ||
| 954 | b.Text = math.floor(bval*255+.5) | |
| 955 | ||
| 956 | for i,v in pairs(r:GetChildren()) do | |
| 957 | ||
| 958 | local n = tonumber(v.Name) | |
| 959 | ||
| 960 | if n then | |
| 961 | ||
| 962 | local sc = n/am | |
| 963 | ||
| 964 | v.BackgroundColor3 = Color3.new(sc,gval,bval) | |
| 965 | ||
| 966 | end | |
| 967 | ||
| 968 | end | |
| 969 | ||
| 970 | for i,v in pairs(g:GetChildren()) do | |
| 971 | ||
| 972 | local n = tonumber(v.Name) | |
| 973 | ||
| 974 | if n then | |
| 975 | ||
| 976 | local sc = n/am | |
| 977 | ||
| 978 | v.BackgroundColor3 = Color3.new(rval,sc,bval) | |
| 979 | ||
| 980 | end | |
| 981 | ||
| 982 | end | |
| 983 | ||
| 984 | for i,v in pairs(b:GetChildren()) do | |
| 985 | ||
| 986 | local n = tonumber(v.Name) | |
| 987 | ||
| 988 | if n then | |
| 989 | ||
| 990 | local sc = n/am | |
| 991 | ||
| 992 | v.BackgroundColor3 = Color3.new(rval,gval,sc) | |
| 993 | ||
| 994 | end | |
| 995 | ||
| 996 | end | |
| 997 | ||
| 998 | if set ~= false then | |
| 999 | ||
| 1000 | if mode == 0 then | |
| 1001 | ||
| 1002 | mycolor = col | |
| 1003 | ||
| 1004 | end | |
| 1005 | ||
| 1006 | if mode == 1 then | |
| 1007 | ||
| 1008 | mycolor2 = col | |
| 1009 | ||
| 1010 | end | |
| 1011 | ||
| 1012 | changeColor() | |
| 1013 | ||
| 1014 | end | |
| 1015 | ||
| 1016 | end | |
| 1017 | ||
| 1018 | update() | |
| 1019 | ||
| 1020 | local rd,gd,bd = false,false,false | |
| 1021 | ||
| 1022 | r.MouseButton1Down:connect(function(x,y) rd = true rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end) | |
| 1023 | ||
| 1024 | r.MouseButton1Up:connect(function() rd = false end) | |
| 1025 | ||
| 1026 | r.MouseLeave:connect(function() rd = false end) | |
| 1027 | ||
| 1028 | r.MouseMoved:connect(function(x,y) if not rd then return end rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end) | |
| 1029 | ||
| 1030 | g.MouseButton1Down:connect(function(x,y) gd = true gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end) | |
| 1031 | ||
| 1032 | g.MouseButton1Up:connect(function() gd = false end) | |
| 1033 | ||
| 1034 | g.MouseLeave:connect(function() gd = false end) | |
| 1035 | ||
| 1036 | g.MouseMoved:connect(function(x,y) if not gd then return end gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end) | |
| 1037 | ||
| 1038 | b.MouseButton1Down:connect(function(x,y) bd = true bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end) | |
| 1039 | ||
| 1040 | b.MouseButton1Up:connect(function() bd = false end) | |
| 1041 | ||
| 1042 | b.MouseLeave:connect(function() bd = false end) | |
| 1043 | ||
| 1044 | b.MouseMoved:connect(function(x,y) if not bd then return end bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end) | |
| 1045 | ||
| 1046 | res.MouseButton1Click:connect(function() | |
| 1047 | ||
| 1048 | rval,gval,bval = themeColor.Color.r,themeColor.Color.g,themeColor.Color.b | |
| 1049 | ||
| 1050 | update() | |
| 1051 | ||
| 1052 | end) | |
| 1053 | ||
| 1054 | ||
| 1055 | local modebtn = Instance.new("TextButton",fr)
| |
| 1056 | ||
| 1057 | modebtn.Position = UDim2.new(1,-150,0,-15) | |
| 1058 | ||
| 1059 | modebtn.Size = UDim2.new(0,49,0,14) | |
| 1060 | ||
| 1061 | modebtn.BackgroundColor3 = Color3.new(1,1,0) | |
| 1062 | ||
| 1063 | modebtn.BackgroundTransparency = .6 | |
| 1064 | ||
| 1065 | modebtn.TextScaled = true | |
| 1066 | ||
| 1067 | modebtn.Font = 4 | |
| 1068 | ||
| 1069 | modebtn.TextColor3 = Color3.new(1,1,1) | |
| 1070 | ||
| 1071 | modebtn.TextStrokeTransparency = .7 | |
| 1072 | ||
| 1073 | modebtn.Text = "Body" | |
| 1074 | ||
| 1075 | modebtn.MouseButton1Click:connect(function() | |
| 1076 | ||
| 1077 | mode = (mode+1)%2 | |
| 1078 | ||
| 1079 | local col = mode == 1 and mycolor2 or mycolor | |
| 1080 | ||
| 1081 | rval,gval,bval = col.r,col.g,col.b | |
| 1082 | ||
| 1083 | modebtn.Text = mode == 0 and "Body" or "Clothes" | |
| 1084 | ||
| 1085 | update(false) | |
| 1086 | ||
| 1087 | end) | |
| 1088 | ||
| 1089 | ||
| 1090 | local outfitbtn = Instance.new("TextButton",fr)
| |
| 1091 | ||
| 1092 | outfitbtn.Position = UDim2.new(1,-150,0,-30) | |
| 1093 | ||
| 1094 | outfitbtn.Size = UDim2.new(0,49,0,14) | |
| 1095 | ||
| 1096 | outfitbtn.BackgroundColor3 = Color3.new(1,1,0) | |
| 1097 | ||
| 1098 | outfitbtn.BackgroundTransparency = .6 | |
| 1099 | ||
| 1100 | outfitbtn.TextScaled = true | |
| 1101 | ||
| 1102 | outfitbtn.Font = 4 | |
| 1103 | ||
| 1104 | outfitbtn.TextColor3 = Color3.new(1,1,1) | |
| 1105 | ||
| 1106 | outfitbtn.TextStrokeTransparency = .7 | |
| 1107 | ||
| 1108 | outfitbtn.Text = "Outfit" | |
| 1109 | ||
| 1110 | outfitbtn.MouseButton1Click:connect(function() | |
| 1111 | ||
| 1112 | outfit = (outfit+1)%(#outfits+1) | |
| 1113 | ||
| 1114 | setOutfit() | |
| 1115 | ||
| 1116 | end) | |
| 1117 | ||
| 1118 | ||
| 1119 | local sparklebtn = Instance.new("TextButton",fr)
| |
| 1120 | ||
| 1121 | sparklebtn.Position = UDim2.new(1,-100,0,-15) | |
| 1122 | ||
| 1123 | sparklebtn.Size = UDim2.new(0,100,0,14) | |
| 1124 | ||
| 1125 | sparklebtn.BackgroundColor3 = Color3.new(0,1,0) | |
| 1126 | ||
| 1127 | sparklebtn.BackgroundTransparency = .6 | |
| 1128 | ||
| 1129 | sparklebtn.TextScaled = true | |
| 1130 | ||
| 1131 | sparklebtn.Font = 4 | |
| 1132 | ||
| 1133 | sparklebtn.TextColor3 = Color3.new(1,1,1) | |
| 1134 | ||
| 1135 | sparklebtn.TextStrokeTransparency = .7 | |
| 1136 | ||
| 1137 | sparklebtn.Text = "Sparkles" | |
| 1138 | ||
| 1139 | sparklebtn.MouseButton1Click:connect(function() | |
| 1140 | ||
| 1141 | senabled = not senabled | |
| 1142 | ||
| 1143 | sparklebtn.BackgroundColor3 = senabled and Color3.new(0,1,0) or Color3.new(1,0,0) | |
| 1144 | ||
| 1145 | end) | |
| 1146 | ||
| 1147 | local lightbtn = Instance.new("TextButton",fr)
| |
| 1148 | ||
| 1149 | lightbtn.Position = UDim2.new(1,-100,0,-30) | |
| 1150 | ||
| 1151 | lightbtn.Size = UDim2.new(0,100,0,14) | |
| 1152 | ||
| 1153 | lightbtn.BackgroundColor3 = Color3.new(0,1,0) | |
| 1154 | ||
| 1155 | lightbtn.BackgroundTransparency = .6 | |
| 1156 | ||
| 1157 | lightbtn.TextScaled = true | |
| 1158 | ||
| 1159 | lightbtn.Font = 4 | |
| 1160 | ||
| 1161 | lightbtn.TextColor3 = Color3.new(1,1,1) | |
| 1162 | ||
| 1163 | lightbtn.TextStrokeTransparency = .7 | |
| 1164 | ||
| 1165 | lightbtn.Text = "Light" | |
| 1166 | ||
| 1167 | lightbtn.MouseButton1Click:connect(function() | |
| 1168 | ||
| 1169 | lenabled = not lenabled | |
| 1170 | ||
| 1171 | lightbtn.BackgroundColor3 = lenabled and Color3.new(0,1,0) or Color3.new(1,0,0) | |
| 1172 | ||
| 1173 | end) | |
| 1174 | ||
| 1175 | end | |
| 1176 | ||
| 1177 | ||
| 1178 | ||
| 1179 | local gyro = root:FindFirstChild("RootGyro") or Instance.new("BodyGyro",root)
| |
| 1180 | ||
| 1181 | gyro.maxTorque = Vector3.new() | |
| 1182 | ||
| 1183 | gyro.Name = "RootGyro" | |
| 1184 | ||
| 1185 | ||
| 1186 | local vel = root:FindFirstChild("RootVel") or Instance.new("BodyVelocity",root)
| |
| 1187 | ||
| 1188 | vel.maxForce = Vector3.new() | |
| 1189 | ||
| 1190 | vel.Name = "RootVel" | |
| 1191 | ||
| 1192 | vel.P = 4000 | |
| 1193 | ||
| 1194 | ||
| 1195 | local flying = false | |
| 1196 | ||
| 1197 | local state = "idle" | |
| 1198 | ||
| 1199 | local kd = {}
| |
| 1200 | ||
| 1201 | local humspd = 0 | |
| 1202 | ||
| 1203 | local flyspeed = 0 | |
| 1204 | ||
| 1205 | local flystop = 0 | |
| 1206 | ||
| 1207 | local sitting = false | |
| 1208 | ||
| 1209 | local holding = false | |
| 1210 | ||
| 1211 | ||
| 1212 | m.KeyDown:connect(function(k) | |
| 1213 | ||
| 1214 | local now = tick() | |
| 1215 | ||
| 1216 | kd[k] = now | |
| 1217 | ||
| 1218 | if k == " " and not flying then | |
| 1219 | ||
| 1220 | pcall(function() sitting:Destroy() end) | |
| 1221 | ||
| 1222 | sitting = nil | |
| 1223 | ||
| 1224 | state = "fly" | |
| 1225 | ||
| 1226 | flying = true | |
| 1227 | ||
| 1228 | flydir = (root.CFrame.lookVector*Vector3.new(1,0,1)).unit | |
| 1229 | ||
| 1230 | elseif k == " " and state == "fly" then | |
| 1231 | ||
| 1232 | flying = false | |
| 1233 | ||
| 1234 | state = "idle" | |
| 1235 | ||
| 1236 | flystop = tick() | |
| 1237 | ||
| 1238 | elseif k == "x" and m.Target and (root.Position-m.Hit.p).magnitude < 20*modelScale then | |
| 1239 | ||
| 1240 | local tar = m.Target | |
| 1241 | ||
| 1242 | local cf = tar.CFrame:toObjectSpace(m.Hit) | |
| 1243 | ||
| 1244 | local siz = tar.Size/2 | |
| 1245 | ||
| 1246 | local cfr | |
| 1247 | ||
| 1248 | local rx,ry,rz = 0,0,0 | |
| 1249 | ||
| 1250 | local lv = tar.CFrame:vectorToObjectSpace(root.CFrame.lookVector) | |
| 1251 | ||
| 1252 | if math.abs(cf.Y-siz.Y) < .03 then | |
| 1253 | ||
| 1254 | cfr = CFrame.new(cf.p + Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
| 1255 | ||
| 1256 | elseif math.abs(-cf.Y-siz.Y) < .03 then | |
| 1257 | ||
| 1258 | cfr = CFrame.new(cf.p - Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),math.pi) | |
| 1259 | ||
| 1260 | elseif math.abs(cf.X-siz.X) < .03 then | |
| 1261 | ||
| 1262 | cfr = CFrame.new(cf.p + Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,-math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
| 1263 | ||
| 1264 | elseif math.abs(-cf.X-siz.X) < .03 then | |
| 1265 | ||
| 1266 | cfr = CFrame.new(cf.p - Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
| 1267 | ||
| 1268 | elseif math.abs(cf.Z-siz.Z) < .03 then | |
| 1269 | ||
| 1270 | cfr = CFrame.new(cf.p + Vector3.new(0,0,3*modelScale)) * CFrame.Angles(math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
| 1271 | ||
| 1272 | elseif math.abs(-cf.Z-siz.Z) < .03 then | |
| 1273 | ||
| 1274 | cfr = CFrame.new(cf.p - Vector3.new(0,0,3*modelScale)) * CFrame.Angles(-math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0) | |
| 1275 | ||
| 1276 | end | |
| 1277 | ||
| 1278 | if cfr then | |
| 1279 | ||
| 1280 | pcall(function() sitting:Destroy() end) | |
| 1281 | ||
| 1282 | flying = false | |
| 1283 | ||
| 1284 | state = "sit" | |
| 1285 | ||
| 1286 | if m.Target.Anchored then | |
| 1287 | ||
| 1288 | sitting = {tar = tar, cf = cfr}
| |
| 1289 | ||
| 1290 | else | |
| 1291 | ||
| 1292 | sitting = weld(tar,root,cfr) | |
| 1293 | ||
| 1294 | end | |
| 1295 | ||
| 1296 | end | |
| 1297 | ||
| 1298 | end | |
| 1299 | ||
| 1300 | end) | |
| 1301 | ||
| 1302 | m.KeyUp:connect(function(k) | |
| 1303 | ||
| 1304 | kd[k] = nil | |
| 1305 | ||
| 1306 | end) | |
| 1307 | ||
| 1308 | ||
| 1309 | hum.Running:connect(function(spd) | |
| 1310 | ||
| 1311 | if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end | |
| 1312 | ||
| 1313 | humspd = spd | |
| 1314 | ||
| 1315 | state = flying and "fly" or (spd < 1 and "idle" or "walk") | |
| 1316 | ||
| 1317 | end) | |
| 1318 | ||
| 1319 | hum.Climbing:connect(function(spd) | |
| 1320 | ||
| 1321 | if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end | |
| 1322 | ||
| 1323 | humspd = spd | |
| 1324 | ||
| 1325 | state = flying and "fly" or (spd < 1 and "idle" or "walk") | |
| 1326 | ||
| 1327 | end) | |
| 1328 | ||
| 1329 | hum.Seated:connect(function(a) | |
| 1330 | ||
| 1331 | state = a and "sit" or humspd > 0 and "idle" or "walk" | |
| 1332 | ||
| 1333 | end) | |
| 1334 | ||
| 1335 | ||
| 1336 | hum.Changed:connect(function() | |
| 1337 | ||
| 1338 | if hum.Jump then | |
| 1339 | ||
| 1340 | hum.Jump = false | |
| 1341 | ||
| 1342 | end | |
| 1343 | ||
| 1344 | end) | |
| 1345 | ||
| 1346 | ||
| 1347 | hum.FreeFalling:connect(function() | |
| 1348 | ||
| 1349 | if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end | |
| 1350 | ||
| 1351 | state = math.abs(tor.Velocity.Y) > 1 and "inair" or state | |
| 1352 | ||
| 1353 | end) | |
| 1354 | ||
| 1355 | ||
| 1356 | hum.FallingDown:connect(function(a) | |
| 1357 | ||
| 1358 | if not a then return end | |
| 1359 | ||
| 1360 | state = "inair" | |
| 1361 | ||
| 1362 | end) | |
| 1363 | ||
| 1364 | ||
| 1365 | ||
| 1366 | ||
| 1367 | while true do | |
| 1368 | ||
| 1369 | runservice.RenderStepped:wait() | |
| 1370 | ||
| 1371 | local cam = workspace.CurrentCamera | |
| 1372 | ||
| 1373 | local alpha = .2 | |
| 1374 | ||
| 1375 | sparkles.Enabled = senabled and flying and tor.Velocity.magnitude > 3 | |
| 1376 | ||
| 1377 | pl.Enabled = lenabled | |
| 1378 | ||
| 1379 | if state ~= "fly" then | |
| 1380 | ||
| 1381 | if type(sitting) == "table" then | |
| 1382 | ||
| 1383 | gyro.maxTorque = Vector3.new(1,1,1)*4e6 | |
| 1384 | ||
| 1385 | vel.maxForce = Vector3.new(1,1,1)*4e5 | |
| 1386 | ||
| 1387 | gyro.cframe = sitting.tar.CFrame * sitting.cf | |
| 1388 | ||
| 1389 | vel.velocity = (gyro.cframe.p-root.Position)*10 | |
| 1390 | ||
| 1391 | else | |
| 1392 | ||
| 1393 | gyro.maxTorque,vel.maxForce = Vector3.new(),Vector3.new() | |
| 1394 | ||
| 1395 | end | |
| 1396 | ||
| 1397 | end | |
| 1398 | ||
| 1399 | if sitting then | |
| 1400 | ||
| 1401 | state = "sit" | |
| 1402 | ||
| 1403 | end | |
| 1404 | ||
| 1405 | tw.MaxVelocity,rh.MaxVelocity,lh.MaxVelocity,rs.MaxVelocity,ls.MaxVelocity,nk.MaxVelocity = 0,0,0,0,0,0 | |
| 1406 | ||
| 1407 | tw.CurrentAngle,rh.CurrentAngle,lh.CurrentAngle,rs.CurrentAngle,ls.CurrentAngle,nk.CurrentAngle = 0,0,0,0,0,0 | |
| 1408 | ||
| 1409 | ||
| 1410 | local hasRobe = outfit == 1 | |
| 1411 | ||
| 1412 | ||
| 1413 | if state == "idle" then | |
| 1414 | ||
| 1415 | hum.PlatformStand = false | |
| 1416 | ||
| 1417 | local breathing = math.sin(tick()*2) | |
| 1418 | ||
| 1419 | local tilt = .02 + breathing*.03 | |
| 1420 | ||
| 1421 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha) | |
| 1422 | ||
| 1423 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha) | |
| 1424 | ||
| 1425 | ||
| 1426 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha) | |
| 1427 | ||
| 1428 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt,hasRobe and 0 or -.1,hasRobe and 0 or .06),alpha) | |
| 1429 | ||
| 1430 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt,hasRobe and 0 or .1,hasRobe and 0 or -.06),alpha) | |
| 1431 | ||
| 1432 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt,0,.1),alpha) | |
| 1433 | ||
| 1434 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt,0,-.1),alpha) | |
| 1435 | ||
| 1436 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.05-.03,0,0),alpha) | |
| 1437 | ||
| 1438 | elseif state == "inair" then | |
| 1439 | ||
| 1440 | hum.PlatformStand = false | |
| 1441 | ||
| 1442 | local wings = math.sin(tick()*80) | |
| 1443 | ||
| 1444 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6) | |
| 1445 | ||
| 1446 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6) | |
| 1447 | ||
| 1448 | local alpha = .15 | |
| 1449 | ||
| 1450 | local tilt = .05 | |
| 1451 | ||
| 1452 | local wavey = math.sin(tick()*3) | |
| 1453 | ||
| 1454 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha) | |
| 1455 | ||
| 1456 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+wavey*.1,0,hasRobe and 0 or .02),alpha) | |
| 1457 | ||
| 1458 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-wavey*.1,0,hasRobe and 0 or -.02),alpha) | |
| 1459 | ||
| 1460 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt-wavey*.07,0,.01),alpha) | |
| 1461 | ||
| 1462 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+wavey*.07,0,-.01),alpha) | |
| 1463 | ||
| 1464 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+.2,0,0),alpha) | |
| 1465 | ||
| 1466 | elseif state == "walk" then | |
| 1467 | ||
| 1468 | hum.PlatformStand = false | |
| 1469 | ||
| 1470 | local walking = math.sin(tick()*25) | |
| 1471 | ||
| 1472 | local breathing = math.sin(tick()*2) | |
| 1473 | ||
| 1474 | local tilt = -.03-breathing*.02+walking*.01 | |
| 1475 | ||
| 1476 | alpha = .6 | |
| 1477 | ||
| 1478 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.05+breathing*.01+walking*.05,0),alpha) | |
| 1479 | ||
| 1480 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.05-breathing*.01+walking*.05,0),alpha) | |
| 1481 | ||
| 1482 | ||
| 1483 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,-walking*.08,0),alpha) | |
| 1484 | ||
| 1485 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+walking*.3,0,hasRobe and 0 or .02),alpha) | |
| 1486 | ||
| 1487 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-walking*.3,0,hasRobe and 0 or -.02),alpha) | |
| 1488 | ||
| 1489 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.05-walking*.25,0,.01),alpha) | |
| 1490 | ||
| 1491 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.05+walking*.25,0,-.01),alpha) | |
| 1492 | ||
| 1493 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04,walking*.07,0),alpha) | |
| 1494 | ||
| 1495 | elseif state == "sit" then | |
| 1496 | ||
| 1497 | hum.Sit = false | |
| 1498 | ||
| 1499 | hum.PlatformStand = true | |
| 1500 | ||
| 1501 | local breathing = math.sin(tick()*2) | |
| 1502 | ||
| 1503 | local upvec = root.CFrame:vectorToWorldSpace(Vector3.new(0,1,0)) | |
| 1504 | ||
| 1505 | if upvec.Y > .4 then | |
| 1506 | ||
| 1507 | local tilt = -.55+breathing*.015 | |
| 1508 | ||
| 1509 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha) | |
| 1510 | ||
| 1511 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha) | |
| 1512 | ||
| 1513 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-1.7,0)*modelScale,alpha) | |
| 1514 | ||
| 1515 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or .6),alpha) | |
| 1516 | ||
| 1517 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or -.6),alpha) | |
| 1518 | ||
| 1519 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.3,0,-.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and .2 or 0,hasRobe and -.2 or 0)+(hasRobe and 0 or 1)*Vector3.new(-.85,-.25,-.25)*modelScale,alpha) | |
| 1520 | ||
| 1521 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.3,0,.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and -.2 or 0,hasRobe and .2 or 0)+(hasRobe and 0 or 1)*Vector3.new(.85,-.25,-.25)*modelScale,alpha) | |
| 1522 | ||
| 1523 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04-.03,0,math.sin(tick()*4)*.06),alpha) | |
| 1524 | ||
| 1525 | else -- wallhug | |
| 1526 | ||
| 1527 | local breathing = math.sin(tick()*5) | |
| 1528 | ||
| 1529 | local tilt = -1.55+breathing*.015 | |
| 1530 | ||
| 1531 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha) | |
| 1532 | ||
| 1533 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha) | |
| 1534 | ||
| 1535 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-2.5,0)*modelScale,alpha) | |
| 1536 | ||
| 1537 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(.2,0,hasRobe and 0 or .5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha) | |
| 1538 | ||
| 1539 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(.2,0,hasRobe and 0 or -.5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha) | |
| 1540 | ||
| 1541 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(2.9,0,.8)+Vector3.new(-.2,.4,0)*modelScale,alpha) | |
| 1542 | ||
| 1543 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(2.9,0,-.8)+Vector3.new(.2,.4,0)*modelScale,alpha) | |
| 1544 | ||
| 1545 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(breathing*.04+.7,0,0),alpha) | |
| 1546 | ||
| 1547 | end | |
| 1548 | ||
| 1549 | elseif state == "fly" then | |
| 1550 | ||
| 1551 | hum.PlatformStand = true | |
| 1552 | ||
| 1553 | gyro.maxTorque = Vector3.new(1,1,1)*4e6 | |
| 1554 | ||
| 1555 | vel.maxForce = Vector3.new(1,1,1)*4e5 | |
| 1556 | ||
| 1557 | ||
| 1558 | local velocity = Vector3.new((kd.d and 1 or 0)+(kd.a and -1 or 0),0,(kd.s and 1 or 0)+(kd.w and -1 or 0)) | |
| 1559 | ||
| 1560 | velocity = cam.CoordinateFrame:vectorToWorldSpace(velocity) | |
| 1561 | ||
| 1562 | local maxspeed = 40-(velocity.magnitude > 0 and velocity.unit.Y*20 or 0) | |
| 1563 | ||
| 1564 | if velocity.magnitude > 0 then | |
| 1565 | ||
| 1566 | flyspeed = lerp(flyspeed,maxspeed,.1) | |
| 1567 | ||
| 1568 | flydir = flydir:Lerp(velocity.unit,.4).unit | |
| 1569 | ||
| 1570 | hoverheight = nil | |
| 1571 | ||
| 1572 | else | |
| 1573 | ||
| 1574 | flyspeed = lerp(flyspeed,0,.3) | |
| 1575 | ||
| 1576 | flydir = (flydir*Vector3.new(1,0,1)).unit | |
| 1577 | ||
| 1578 | hoverheight = hoverheight or root.Position.Y | |
| 1579 | ||
| 1580 | end | |
| 1581 | ||
| 1582 | vel.velocity = flydir.unit * flyspeed | |
| 1583 | ||
| 1584 | if hoverheight then | |
| 1585 | ||
| 1586 | vel.velocity = vel.velocity + Vector3.new(0,hoverheight-root.Position.Y,0) | |
| 1587 | ||
| 1588 | end | |
| 1589 | ||
| 1590 | gyro.cframe = CFrame.new(Vector3.new(),flydir*Vector3.new(1,0,1)) | |
| 1591 | ||
| 1592 | ||
| 1593 | rl.CanCollide,ll.CanCollide = true,true | |
| 1594 | ||
| 1595 | ||
| 1596 | local wings = math.sin(tick()*80) | |
| 1597 | ||
| 1598 | w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6) | |
| 1599 | ||
| 1600 | w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6) | |
| 1601 | ||
| 1602 | local alpha = .15 | |
| 1603 | ||
| 1604 | local flytilt = (flyspeed/maxspeed) | |
| 1605 | ||
| 1606 | local tilt = flytilt*-1.4 + math.asin(gyro.cframe:vectorToObjectSpace(flydir).unit.Y) | |
| 1607 | ||
| 1608 | local wavey = math.sin(tick()*6) | |
| 1609 | ||
| 1610 | tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha) | |
| 1611 | ||
| 1612 | rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(wavey*.1,hasRobe and 0 or -.08,hasRobe and 0 or .1),alpha) | |
| 1613 | ||
| 1614 | lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-wavey*.1,hasRobe and 0 or .08,hasRobe and 0 or -.1),alpha) | |
| 1615 | ||
| 1616 | rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-wavey*.15,-.08,.1),alpha) | |
| 1617 | ||
| 1618 | ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(wavey*.15,.08,-.1),alpha) | |
| 1619 | ||
| 1620 | nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt*.8,0,0),alpha) | |
| 1621 | ||
| 1622 | end | |
| 1623 | ||
| 1624 | end |