Advertisement
Ultimate_69

Stand Module

Feb 6th, 2025
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. local stand = {}
  2.  
  3. -- POSITIONS: Behind (-2.065, 0.6, 1.804), Default (0, 0, 0), InFront (-0.1, 0, -2.695)
  4.  
  5. local TweenService = game:GetService("TweenService")
  6. local standTweenInfo = TweenInfo.new(0.5)
  7. local standMoveInfo = TweenInfo.new(0.5)
  8.  
  9. function stand.Move(weld: Weld, position)
  10. Move(weld, position)
  11. end
  12.  
  13. function Move(weld: Weld, position)
  14. if position == "Behind" then
  15. local moveTween = TweenService:Create(weld, standMoveInfo, { C0 = CFrame.new(-2.065, 0.6, 1.804) })
  16. moveTween:Play()
  17. elseif position == "Default" then
  18. local moveTween = TweenService:Create(weld, standMoveInfo, { C0 = CFrame.new(0, 0, 0) })
  19. moveTween:Play()
  20. elseif position == "InFront" then
  21. local moveTween = TweenService:Create(weld, standMoveInfo, { C0 = CFrame.new(-0.1, 0, -2.695) })
  22. moveTween:Play()
  23. end
  24.  
  25. end
  26.  
  27. function stand.Summon(char, stand)
  28. local hrp = char.HumanoidRootPart
  29.  
  30. local standRp = stand.HumanoidRootPart
  31.  
  32. standRp.CFrame = hrp.CFrame
  33.  
  34. stand.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
  35. stand.Humanoid.PlatformStand = true
  36.  
  37. local weld = Instance.new("Weld")
  38. weld.Part0 = hrp
  39. weld.Part1 = standRp
  40. weld.Parent = hrp
  41.  
  42. for i,v in pairs(stand:GetChildren()) do
  43. if v:IsA("Part") or v:IsA("BasePart") then
  44. if v.Name == "HumanoidRootPart" then continue end
  45. v.Transparency = 1
  46. local tween = TweenService:Create(v, standTweenInfo, { Transparency = 0 })
  47. tween:Play()
  48. elseif v:IsA("Accessory") then
  49. local x = v.Handle
  50. x.Transparency = 1
  51. local tween = TweenService:Create(x, standTweenInfo, { Transparency = 0 })
  52. tween:Play()
  53. end
  54. end
  55.  
  56. Move(weld, "Behind")
  57.  
  58. stand.Parent = char
  59.  
  60. local anim: AnimationTrack = stand.Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Stands.Summon)
  61. anim:Play()
  62. anim.Ended:Once(function()
  63. stand.StandAnimate.Enabled = true
  64. end)
  65.  
  66. local sound = game.SoundService.Stands.Summon:Clone()
  67. sound.Parent = stand
  68. sound:Destroy()
  69.  
  70. local standSound = game.SoundService.Stands[char:GetAttribute("Stand")].SummonSpeech:Clone()
  71. standSound.Parent = stand
  72. standSound:Destroy()
  73. end
  74.  
  75. function stand.DeSummon(char: Model)
  76. local stand = char:FindFirstChild("Stand", true).Parent
  77. for i,v in pairs(stand:GetChildren()) do
  78. if v:IsA("Part") or v:IsA("BasePart") then
  79. if v.Name == "HumanoidRootPart" then continue end
  80. v.Transparency = 0
  81. local tween = TweenService:Create(v, standTweenInfo, { Transparency = 1 })
  82. tween:Play()
  83. tween.Completed:Once(function()
  84. stand:Destroy()
  85. end)
  86. elseif v:IsA("Accessory") then
  87. local x = v.Handle
  88. x.Transparency = 0
  89. local tween = TweenService:Create(x, standTweenInfo, { Transparency = 1 })
  90. tween:Play()
  91. end
  92. end
  93.  
  94. stand:SetAttribute("StandState", "Desummon")
  95. Move(char.HumanoidRootPart.Weld, "Default")
  96. task.wait(0.5)
  97. char.HumanoidRootPart.Weld:Destroy()
  98. end
  99.  
  100. return stand
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement