Loop throgh the checkpoints and see if you find the last spawnpoint, then use the teleport script.
Yeah you should, I will think of a way to fix this
Script 1 in SSS (Module Script):
local Module = {}
local RE = game.ReplicatedStorage.Ragdoll
local PS = game:GetService("PhysicsService")
Module.Ragdoll = function(char,bool)
local plr = game.Players:GetPlayerFromCharacter(char)
if char.Humanoid.Health~=0 and ((char:FindFirstChild'LowerTorso'and not char.LowerTorso.Root.Enabled)or (char:FindFirstChild'Torso'and not char.Torso.Neck.Enabled)) and not bool then
RE:FireClient(plr,false)
for _,v in pairs(char:GetDescendants()) do
if v:IsA'Motor6D' then
v.Enabled = true
elseif v:IsA'BallSocketConstraint' then
v.Enabled = false
end
end
else
RE:FireClient(plr,true)
for _,v in pairs(char:GetDescendants()) do
if v:IsA'Motor6D'and Module.Check(v.Name)then
v.Enabled = false
elseif v:IsA'BallSocketConstraint' then
v.Enabled = true
elseif v.Name=="Head"then
local b = Instance.new("BodyVelocity",char.Head)
b.Velocity = Vector3.new(math.random(-10,10),0,math.random(-10,10))
task.spawn(function()
b:Destroy()
end)
end
end
end
end
Module.Bot = function(bot)
task.spawn(function()
local H = bot.Humanoid
if bot:FindFirstChild'HumanoidRootPart'and H.Health~=0 and bot:FindFirstChild'LowerTorso' and bot.LowerTorso.Root.Enabled==true then
H:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
H:ChangeState(Enum.HumanoidStateType.Ragdoll)
for _,v in pairs(H:GetPlayingAnimationTracks())do v:Stop(0)end
bot.Animate.Disabled = true
for _,v in pairs(bot:GetDescendants()) do
if v:IsA'Motor6D'and Module.Check(v.Name) then
v.Enabled = false
elseif v:IsA'BallSocketConstraint' then
v.Enabled = true
end
end
wait(10)
bot.Animate.Disabled = false
H:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
H:ChangeState(Enum.HumanoidStateType.GettingUp)
for _,v in pairs(bot:GetDescendants()) do
if v:IsA'Motor6D' then
v.Enabled = true
elseif v:IsA'BallSocketConstraint' then
v.Enabled = false
end
end
end
end)
end
Module.Check = function(t)
for _,v in pairs({"LeftWrist","LeftAnkle","RightAnkle"}) do
if v == t then return false end
end
return true
end
Module.Joints = function(c)
c.Humanoid.BreakJointsOnDeath = false
c.Humanoid.RequiresNeck = false
for _,v in pairs(c:GetDescendants()) do
if v:IsA("Motor6D")and Module.Check(v.Name)then
local b = Instance.new("BallSocketConstraint",v.Parent)
local a0,a1 = Instance.new("Attachment"),Instance.new("Attachment")
a0.Parent,a1.Parent = v.Part0,v.Part1
b.Attachment0,b.Attachment1 = a0,a1
a0.CFrame,a1.CFrame = v.c0,v.c1
b.LimitsEnabled = true
b.TwistLimitsEnabled = true
b.Enabled = false
elseif v:IsA'BasePart' then
PS:SetPartCollisionGroup(v,"A")
if v.Name == "HumanoidRootPart" then
PS:SetPartCollisionGroup(v,"B")
elseif v.Name=="Head"then
v.CanCollide = true
end
end
end
end
return Module
Script 2 also in SSS
local M = require(game.ServerScriptService.Others.Module)
local P = game:GetService("PhysicsService")
P:CreateCollisionGroup("A")
P:CreateCollisionGroup("B")
P:CollisionGroupSetCollidable("A","B",false)
game.ReplicatedStorage.Ragdoll.OnServerEvent:Connect(function(plr,a)
local char = plr.Character or plr.CharacterAdded:Wait()
M.Ragdoll(char,a)
end)
local function Vel(v,p)
local a=90
if (v.X<=-a or v.X>=a or v.Y<=-a or v.Y>=a or v.Z<=-a or v.Z>=a)then --Velocity Checks
return true
end
return false
end
local db = false
local RS = game:GetService("RunService")
RS.Heartbeat:Connect(function()
for _,v in pairs(game.Players:GetPlayers())do
local c = v.Character or v.CharacterAdded:Wait()
local H = c.Humanoid
if c:FindFirstChild'HumanoidRootPart'and H.Health~=0 and Vel(c.HumanoidRootPart.Velocity)and c:FindFirstChild'LowerTorso' and c.LowerTorso.Root.Enabled==true then
M.Ragdoll(c,"")
end
end
end)
Script 3 in StarterCharacterScript:
local M = require(game.ServerScriptService.Others.Module)
local P = game:GetService("PhysicsService")
local c = script.Parent
local userInput = game:GetService("UserInputService")
M.Joints(c)
userInput.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
M.Ragdoll(c)
end
end)
Wow… that was a lot…
This Just resets the player just to get rid of the ragdoll script and then teleports the player to the part.
Let me know if it fixes anything
1 Like
Thanks! That worked good enough!
1 Like