Joriangames

Fake Death SCRIPT

Jan 11th, 2024
1,616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. -- HOW TO MAKE TEMPORARY FAKE DEATH!!! Roblox Studio Tutorial BY BLOXIANCODE youtube.com/c/BloxianCode
  2. -- Tutorial: https://youtu.be/WS23QeL8mV8
  3.  
  4. game.ReplicatedStorage.FakeDeath.OnServerEvent:Connect(function(plr)
  5.     print("Got signal")
  6.     local char = plr.Character or plr.CharacterAdded:Wait()
  7.    
  8.     local hum
  9.  
  10.     while not hum do
  11.         hum = char:FindFirstChildOfClass("Humanoid")
  12.         if not hum then
  13.             char.ChildAdded:Wait()
  14.         end
  15.     end
  16.  
  17.     hum.BreakJointsOnDeath = false
  18.    
  19.     --START THE FAKE DEATH
  20.  
  21.     ----ADDING DEFAULT DEATH SOUND
  22.     local soundId = "rbxassetid://6650836024" --the soundId for the default roblox death sound
  23.     local sound = Instance.new("Sound")
  24.     sound.SoundId = soundId
  25.     sound.Looped = false
  26.     sound.Parent = char.Head
  27.     sound.Playing = true
  28.     ---/END OF CODE ADDING DEFAULT DEATH SOUND
  29.     char.Head.Anchored = true
  30.     hum.RequiresNeck = false
  31.     hum:ChangeState(Enum.HumanoidStateType.Physics)
  32.     for i, item in pairs(char:GetDescendants()) do
  33.         if item:IsA("Motor6D") then
  34.             item.Enabled = false
  35.         end
  36.     end
  37.    
  38.     wait(5)
  39.  
  40.     --UNDO THE FAKE DEATH
  41.     char.Head.Anchored = false
  42.     hum:ChangeState(Enum.HumanoidStateType.Ragdoll) --bringing player back to normal state
  43.     for i, item in pairs(char:GetDescendants()) do
  44.         if item:IsA("Motor6D") then
  45.             item.Enabled = true
  46.  
  47.         elseif item:IsA("Sound") then
  48.             if sound.SoundId == "rbxassetid://6650836024" then --the soundId for the default roblox death sound
  49.                 sound:Destroy()
  50.             end
  51.         end
  52.     end
  53. end)
  54.  
Advertisement
Add Comment
Please, Sign In to add comment