-
Notifications
You must be signed in to change notification settings - Fork 4
/
Headless
43 lines (38 loc) · 1.42 KB
/
Headless
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
-- services
local players = game:GetService("Players")
local starterGui = game:GetService("StarterGui")
-- objects
local player = players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
local head, torso = character:FindFirstChild("Head"), character:FindFirstChild("UpperTorso")
local resetBindable = Instance.new("BindableEvent")
-- variables
local destroyFunc, resetBindableConnection = character.Destroy, nil
-- main
-- initializes the permadeath
player.Character = nil
player.Character = character
task.wait(players.RespawnTime + .05)
humanoid.BreakJointsOnDeath = false
humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
if humanoid.RigType == Enum.HumanoidRigType.R15 then
task.defer(destroyFunc, (head.Neck))
end
task.defer(destroyFunc, head) -- and we destroy the head
resetBindableConnection = resetBindable.Event:Connect(function()
starterGui:SetCore("ResetButtonCallback", true)
resetBindableConnection:Disconnect()
if player.Character == character then
character:Destroy()
local daModel = Instance.new("Model")
local _daModelHumanoid = Instance.new("Humanoid")
_daModelHumanoid.Parent = daModel
player.Character = daModel
task.delay(players.RespawnTime, destroyFunc, daModel)
else
player.Character:BreakJoints()
end
end)
starterGui:SetCore("ResetButtonCallback", resetBindable)
--fixed for synapse