Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- HOW TO MAKE TEMPORARY FAKE DEATH!!! Roblox Studio Tutorial BY BLOXIANCODE youtube.com/c/BloxianCode
- -- Tutorial: https://youtu.be/WS23QeL8mV8
- game.ReplicatedStorage.FakeDeath.OnServerEvent:Connect(function(plr)
- print("Got signal")
- local char = plr.Character or plr.CharacterAdded:Wait()
- local hum
- while not hum do
- hum = char:FindFirstChildOfClass("Humanoid")
- if not hum then
- char.ChildAdded:Wait()
- end
- end
- hum.BreakJointsOnDeath = false
- --START THE FAKE DEATH
- ----ADDING DEFAULT DEATH SOUND
- local soundId = "rbxassetid://6650836024" --the soundId for the default roblox death sound
- local sound = Instance.new("Sound")
- sound.SoundId = soundId
- sound.Looped = false
- sound.Parent = char.Head
- sound.Playing = true
- ---/END OF CODE ADDING DEFAULT DEATH SOUND
- char.Head.Anchored = true
- hum.RequiresNeck = false
- hum:ChangeState(Enum.HumanoidStateType.Physics)
- for i, item in pairs(char:GetDescendants()) do
- if item:IsA("Motor6D") then
- item.Enabled = false
- end
- end
- wait(5)
- --UNDO THE FAKE DEATH
- char.Head.Anchored = false
- hum:ChangeState(Enum.HumanoidStateType.Ragdoll) --bringing player back to normal state
- for i, item in pairs(char:GetDescendants()) do
- if item:IsA("Motor6D") then
- item.Enabled = true
- elseif item:IsA("Sound") then
- if sound.SoundId == "rbxassetid://6650836024" then --the soundId for the default roblox death sound
- sound:Destroy()
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment