Difference between revisions of "API:Class/Workspace/FallenPartsDestroyHeight"

 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{APIMemberPage
 
{{APIMemberPage
|Description=Sets the height at which falling characters and parts are destroyed. This property can be read by scripts, but can only be written to by plugins, the command bar, or the properties window.
+
|Description=FallenPartsDestroyHeight sets the height at which falling characters and parts are destroyed. This property can be read by scripts, but can only be written to by plugins, the command bar, or the properties window. If a part hits the FallenPartsDestroyHeight, and it was the last object inside of a {{ClassLink|Model}}, the Model will be destroyed as well.
|Notes=
+
|DescriptionShort=Sets the height at which falling characters and parts are destroyed.
* If a part hits the FallenPartsDestroyHeight, and it was the last object inside of a {{ClassLink|Model}}, the Model will be destroyed as well.
+
|Example=Click the link to go to the place with a working version of this example: [[https://www.roblox.com/games/1084900423/FallingPartsDestroyHeight Destroy Height Place]].
 +
 
 +
The place is not copy-locked so it can be opened in Studio by anyone.
 +
==Server side script==
 +
{{Code|=
 +
-- setting the spawn location
 +
local SpawnLocation = Instance.new("SpawnLocation")
 +
local spawnPosition = SpawnLocation.Position
 +
 
 +
-- reading the destroy height and seeting the camera view
 +
local height = game.Workspace.FallenPartsDestroyHeight
 +
local OFFSET = Vector3.new(-20,60,-20)
 +
local camera = game.Workspace.CurrentCamera
 +
local FIELD_OF_VIEW = 50
 +
local cameraPosition = spawnPosition + OFFSET
 +
camera.CoordinateFrame = CFrame.new(cameraPosition, spawnPosition)
 +
 
 +
while true do
 +
-- creating a part
 +
local Part = Instance.new('Part')
 +
 +
-- adding it to the workspace
 +
Part.Parent = game.Workspace
 +
 +
-- setting it's position
 +
Part.Position = spawnPosition + Vector3.new(0,height,0) + OFFSET
 +
 +
wait(5)
 +
end
 +
|highlight=6}}
 
}}
 
}}

Latest revision as of 19:31, 4 October 2017

FallenPartsDestroyHeight

PluginSecurity: This member cannot be used in scripts, but is usable in the command bar and plugins.
Property of Workspace icon.pngWorkspace

Value Type: float
Description: FallenPartsDestroyHeight sets the height at which falling characters and parts are destroyed. This property can be read by scripts, but can only be written to by plugins, the command bar, or the properties window. If a part hits the FallenPartsDestroyHeight, and it was the last object inside of a Model icon.pngModel, the Model will be destroyed as well.

Example

Click the link to go to the place with a working version of this example: [Destroy Height Place].

The place is not copy-locked so it can be opened in Studio by anyone.

Server side script

-- setting the spawn location
local SpawnLocation = Instance.new("SpawnLocation")
local spawnPosition = SpawnLocation.Position
 
-- reading the destroy height and seeting the camera view
local height = game.Workspace.FallenPartsDestroyHeightlocal OFFSET = Vector3.new(-20,60,-20)
local camera = game.Workspace.CurrentCamera
local FIELD_OF_VIEW = 50
local cameraPosition = spawnPosition + OFFSET
camera.CoordinateFrame = CFrame.new(cameraPosition, spawnPosition)	
 
while true do
	-- creating a part
	local Part = Instance.new('Part')
 
	-- adding it to the workspace
	Part.Parent = game.Workspace
 
	-- setting it's position
	Part.Position = spawnPosition + Vector3.new(0,height,0) + OFFSET
 
	wait(5)
end