Okay, so if you are not familiar with "Stands", it is basically your ability and it is from the anime "JoJo's Bizarre Adventure"
I have an issue where when my character dies, the stand just disappears. I tried unsummoning the stand when the player dies but i had no success, i also tried manually moving it to a different location but for some reason it just doesn't work. Am I missing something?
Sorry if my coding is messy or such, this is my whole summoning script. I learned along the way and some of it may be inefficient or such.
local ReplicatedStorage = game.ReplicatedStorage local AnimationsDir = ReplicatedStorage.Animations local AnimFloatDir = AnimationsDir.Floating local AnimEtcDir = AnimationsDir.Etc local AnimGroundDir = AnimationsDir.Ground local character = script.Parent local TweenService = game:GetService("TweenService") local function summonStand(player) if player.Character.Name == character.Name then print("starting stand summon") local standLoc = game.ReplicatedStorage.TempStands:FindFirstChild(player.Name) local stand = standLoc:FindFirstChild("Stand") local standVal = standLoc:FindFirstChild("StandSummoned") local obtained = standLoc:FindFirstChild("StandObtained") if obtained.Value == true then standVal.Value = true stand.Parent = player.Character wait(0.1) local hum = stand:WaitForChild("AnimController") -- Find the Humanoid local anim = hum:LoadAnimation(AnimFloatDir.Idle) -- It finds anything inside of the script that is "Animation" and loads it. anim:Play() stand.Head.Summon:Play() print("summoned") -- stand.HumanoidRootPart.CFrame = character.HumanoidRootPart.CFrame*CFrame.new(-3, 2, 3) weld = Instance.new("Weld") weld.Parent = stand.HumanoidRootPart weld.Part0 = stand.HumanoidRootPart weld.Part1 = character.HumanoidRootPart weld.C0 = CFrame.new(-3, -2, -3) local goal = {} goal.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame) goal.C1 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame * CFrame.new(-3,1,2)) local info = TweenInfo.new(.5) local tween = TweenService:Create(weld, info, goal) tween:Play() noCollisionConstraint = Instance.new("NoCollisionConstraint") noCollisionConstraint.Parent = character.HumanoidRootPart noCollisionConstraint.Part0 = stand.HumanoidRootPart noCollisionConstraint.Part1 = character.HumanoidRootPart noCollisionConstraint2 = Instance.new("NoCollisionConstraint") noCollisionConstraint2.Parent = character.Head noCollisionConstraint2.Part0 = stand.HumanoidRootPart noCollisionConstraint2.Part1 = character.Head noCollisionConstraint3 = Instance.new("NoCollisionConstraint") noCollisionConstraint3.Parent = character.Torso noCollisionConstraint3.Part0 = stand.HumanoidRootPart noCollisionConstraint3.Part1 = character.Torso noCollisionConstraint4 = Instance.new("NoCollisionConstraint") noCollisionConstraint4.Parent = character.HumanoidRootPart noCollisionConstraint4.Part0 = stand.Torso noCollisionConstraint4.Part1 = character.HumanoidRootPart noCollisionConstraint5 = Instance.new("NoCollisionConstraint") noCollisionConstraint5.Parent = character.Torso noCollisionConstraint5.Part0 = stand.Torso noCollisionConstraint5.Part1 = character.Torso noCollisionConstraint6 = Instance.new("NoCollisionConstraint") noCollisionConstraint6.Parent = character.Head noCollisionConstraint6.Part0 = stand.Torso noCollisionConstraint6.Part1 = character.Head noCollisionConstraint7 = Instance.new("NoCollisionConstraint") noCollisionConstraint7.Parent = character.HumanoidRootPart noCollisionConstraint7.Part0 = stand.Head noCollisionConstraint7.Part1 = character.HumanoidRootPart noCollisionConstraint8 = Instance.new("NoCollisionConstraint") noCollisionConstraint8.Parent = character.Torso noCollisionConstraint8.Part0 = stand.Head noCollisionConstraint8.Part1 = character.Torso noCollisionConstraint9 = Instance.new("NoCollisionConstraint") noCollisionConstraint9.Parent = character.Head noCollisionConstraint9.Part0 = stand.Head noCollisionConstraint9.Part1 = character.Head for i, v in ipairs(stand:GetDescendants()) do if v:IsA("BasePart") then v.CanCollide = false v.Massless = true end end else print("not ready") end end end local function unsummonStand(player) if player.Character.Name == character.Name then print("starting stand unsummon") local standLoc = game.ReplicatedStorage.TempStands:FindFirstChild(player.Name) if player.Character:FindFirstChild("Stand")then local stand = player.Character:FindFirstChild("Stand") local standVal = standLoc:FindFirstChild("StandSummoned") local obtained = standLoc:FindFirstChild("StandObtained") if obtained.Value == true then standVal.Value = false stand.Parent = standLoc print("unsummoned") weld:Destroy() noCollisionConstraint:Destroy() noCollisionConstraint2:Destroy() noCollisionConstraint3:Destroy() noCollisionConstraint4:Destroy() noCollisionConstraint5:Destroy() noCollisionConstraint6:Destroy() noCollisionConstraint7:Destroy() noCollisionConstraint8:Destroy() noCollisionConstraint9:Destroy() end end end end local function standDie(player) local stand = player.Character:FindFirstChild("Stand") stand:Destroy() -- repeat -- warn("Waiting...") -- wait(0.1) --until player.Character:WaitForChild("Humanoid") --local standName = ReplicatedStorage.Standstore:FindFirstChild(player.name) --local newStand = ReplicatedStorage.Stands:FindFirstChild(standName.Value) --local newStandModel = newStand:Clone() --newStandModel.Parent = ReplicatedStorage.TempStands:FindFirstChild(player.name) -- print("done death cycle") end game.ReplicatedStorage.Functions.SummonStand.OnServerEvent:Connect(summonStand) game.ReplicatedStorage.Functions.UnsummonStand.OnServerEvent:Connect(unsummonStand) game.ReplicatedStorage.Functions.StandDie.OnServerEvent:Connect(standDie)
Thanks!