Buzzy

Loading...

Buzzy

Register

Roblox Studio Tutorials - June 17, 2021

How to Make a Falling Part on Delay

1

Buzzy Beth

@buzzygamesbeth

  • hello everyone and today i’ll be showing you how you can make falling parts that are on a delay
  • first you’re going to get one or two parts and put them in the air
  • my parts are 11 units in the air and you’re going to put them both together in a model
  • then you’re going to put a script onto your part and it’s going to look something like this
  • we have our variables up here we have our function that is on touch
  • we see if it’s a humanoid or if it’s falling and if it’s not falling then we go and we make it fall after a slight delay
  • i should mention this number right heres hould be something where the part is going to reset because after it hits this number as it’s falling it’s going to reset
  • and then once your script is done you can go and if you touch a block after a one second delay it will fall
local part = script.Parent
local reset = part.CFrame 
local falling = false

local function Ontouch(otherPart)
	local character = otherPart.Parent
	local humanoid = character:FindFirstChildWhichIsA("Humanoid")
	
	if humanoid and falling ∼= true then
		falling = true
		wait(1)
		while part.Position.Y > 5 do
			part.Position = part.Position + Vector3.new(0, -2, 0)
			wait(0.1)
		end
		part.CFrame = reset
		falling = false
	end
end
part.Touched:Connect(Ontouch()