How to achieve something like FallPartsDestroyHeight to a player in a script?

Hello.
I am making a monster in which if it touches you, your player will “disappear” making it look like the monster consumed the player (The monster is a shadow by using particle effects). I want the player to respawn after disappearing.

I tried using functions like “:Destroy()” on the player in the script but the player won’t respawn. Any way to achieve something like this?

if the player “disappears”, that doesn’t mean their dead… right?

Oh no, theyre totally dead at that point.

This is a basic example:

script.Parent.Touched:Connect(function(t)
	local Hum = t.Parent:FindFirstChild("Humanoid") -- Humanoid
	if Hum then -- if Humanoid Exists
		Hum.Health = 0 -- Kills Player
		for _,i in t.Parent:GetDescendants() do -- iterates through Character
			if not i:IsA("Humanoid") then -- if Instances arent a Humanoid
				i:Destroy() -- Destroys Instances
			end
		end
	end
end)

The not Removing the Humanoid is so there aren’t any errors with specific events that fire for the Humanoid
However you can just do: if i:IsA("BasePart") then

FallenPartsDestroyHeight only Destroys BaseParts so this would make an ideal sufficient script

there’s a function called :LoadCharacter() from the Player object.

you can have a look at the code example here:
https://create.roblox.com/docs/reference/engine/classes/Player#LoadCharacter

though :LoadCharacter() can only be called from the server, you can use a RemoteEvent to send a request to the server to respawn the player using a TextButton or ImageButton

note that .CharacterAutoLoads must be false in order for :LoadCharacter() to have any effect.

LoadCharacter just Repsawns the Character Instantly, I dont think thats what he wants.

I implemented that in my script but it doesn’t seem to be working. I seem to die, but I don’t disappear?

Here is my script:

local SCP017 = script.Parent.Parent.ShadowPerson
local Killsound = script.Parent.Kill
local Killsound2 = script.Parent.Kill2
local Killsound3 = script.Parent.Kill3
local Killsound4 = script.Parent.Kill4
local TargetBrick = script.Parent.Parent.TargetBrick
local Particle = script.Parent.Parent.ParticleBlock.ParticleEmitter
local VictimHide = script.Parent.Parent.VictimHide

local Attacking = false

function onTouch(part) 
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) and humanoid.Health > 0 and Attacking == false then
	Attacking = true
		local KillSoundRandomizer = math.random(1,4)
		if KillSoundRandomizer == 1 then
			humanoid.WalkSpeed = 0
			SCP017.WalkSpeed = 0
			humanoid.WalkSpeed = 0
			humanoid.Parent.HumanoidRootPart.Anchored = true
			wait(1)
			Particle.Size = NumberSequence.new(1,7)
			wait(.6)
			SCP017.Parent.HumanoidRootPart.Anchored = true
			Killsound:Play()
			wait(.4)
			script.Parent.Touched:Connect(function(t)
				if humanoid then -- if Humanoid Exists
					humanoid.Health = 0 -- Kills Player
					for _,i in humanoid.Parent:GetDescendants() do -- iterates through Character
						if not humanoid:IsA("Humanoid") then -- if Instances arent a Humanoid
							humanoid:Destroy() -- Destroys Instances
						end
					end
				end
			end)
			VictimHide.Transparency = 0
			wait(8)
			humanoid.BreakJointsOnDeath = false
			VictimHide.Transparency = 1
			Particle.Size = NumberSequence.new(7,1)
			SCP017.WalkSpeed = 50
			SCP017.Parent.HumanoidRootPart.Anchored = false
		end
	Attacking = false
end 
end
script.Parent.Touched:connect(onTouch)

I’ve never used for _,i ever so I may have messed something up.

Yep. I want the players body to be gone, but the camera to stay until they automatically respawn.

Make an exception for the head which makes it transparent and not destroyed. If you destroy the head, the character dies.

I want the character to die. But this helps! I’ll be sure to keep this in mind in case I want to implement this in the future. Thank you!

Nevermind. I just played around with the variables and got it running. Thank you so much man! I understand a little bit more now. Thanks for everyone that took their time to reply to this thread!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.