Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local stand = {}
- -- POSITIONS: Behind (-2.065, 0.6, 1.804), Default (0, 0, 0), InFront (-0.1, 0, -2.695)
- local TweenService = game:GetService("TweenService")
- local standTweenInfo = TweenInfo.new(0.5)
- local standMoveInfo = TweenInfo.new(0.5)
- function stand.Move(weld: Weld, position)
- Move(weld, position)
- end
- function Move(weld: Weld, position)
- if position == "Behind" then
- local moveTween = TweenService:Create(weld, standMoveInfo, { C0 = CFrame.new(-2.065, 0.6, 1.804) })
- moveTween:Play()
- elseif position == "Default" then
- local moveTween = TweenService:Create(weld, standMoveInfo, { C0 = CFrame.new(0, 0, 0) })
- moveTween:Play()
- elseif position == "InFront" then
- local moveTween = TweenService:Create(weld, standMoveInfo, { C0 = CFrame.new(-0.1, 0, -2.695) })
- moveTween:Play()
- end
- end
- function stand.Summon(char, stand)
- local hrp = char.HumanoidRootPart
- local standRp = stand.HumanoidRootPart
- standRp.CFrame = hrp.CFrame
- stand.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
- stand.Humanoid.PlatformStand = true
- local weld = Instance.new("Weld")
- weld.Part0 = hrp
- weld.Part1 = standRp
- weld.Parent = hrp
- for i,v in pairs(stand:GetChildren()) do
- if v:IsA("Part") or v:IsA("BasePart") then
- if v.Name == "HumanoidRootPart" then continue end
- v.Transparency = 1
- local tween = TweenService:Create(v, standTweenInfo, { Transparency = 0 })
- tween:Play()
- elseif v:IsA("Accessory") then
- local x = v.Handle
- x.Transparency = 1
- local tween = TweenService:Create(x, standTweenInfo, { Transparency = 0 })
- tween:Play()
- end
- end
- Move(weld, "Behind")
- stand.Parent = char
- local anim: AnimationTrack = stand.Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Stands.Summon)
- anim:Play()
- anim.Ended:Once(function()
- stand.StandAnimate.Enabled = true
- end)
- local sound = game.SoundService.Stands.Summon:Clone()
- sound.Parent = stand
- sound:Destroy()
- local standSound = game.SoundService.Stands[char:GetAttribute("Stand")].SummonSpeech:Clone()
- standSound.Parent = stand
- standSound:Destroy()
- end
- function stand.DeSummon(char: Model)
- local stand = char:FindFirstChild("Stand", true).Parent
- for i,v in pairs(stand:GetChildren()) do
- if v:IsA("Part") or v:IsA("BasePart") then
- if v.Name == "HumanoidRootPart" then continue end
- v.Transparency = 0
- local tween = TweenService:Create(v, standTweenInfo, { Transparency = 1 })
- tween:Play()
- tween.Completed:Once(function()
- stand:Destroy()
- end)
- elseif v:IsA("Accessory") then
- local x = v.Handle
- x.Transparency = 0
- local tween = TweenService:Create(x, standTweenInfo, { Transparency = 1 })
- tween:Play()
- end
- end
- stand:SetAttribute("StandState", "Desummon")
- Move(char.HumanoidRootPart.Weld, "Default")
- task.wait(0.5)
- char.HumanoidRootPart.Weld:Destroy()
- end
- return stand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement