How to make lava

From Goodblox Wiki
Jump to navigationJump to search

Introduction

This tutorial will help you to learn about how to make "lava". This must be done in GoodBlox Studio.

Getting started

To get started, you will need a brick.

To insert a brick, go to Insert, then Object...
Template:Studio
Template:Studio
In the window that pops up, find Part, then click OK.

Once you have a brick, resize and color it as you like. You will probably want a red brick to simulate the color of lava.

Lava script

Next, you have to make the lava damage people. In the Explorer panel, make sure you have selected the brick you inserted. Then, insert a script.

To insert a script, go to Insert, then Object...
In the window, find Script, then click OK.

Once you have inserted a script into your brick, find it in the Explorer panel, and double-click it to open the script editor.

Copy the following and paste it into the script:

function onTouch(part) 
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then	-- if a humanoid exists, then
		humanoid.Health = 0	-- damage the humanoid
	end 
end

script.Parent.Touched:connect(onTouch)

Once you have done that, click the Close Tab File:P01F15.png button to exit the script editor.