본문 바로가기
Programming/Roblox

로블록스로 배우는 코딩 #6 - 용암을 밟으면 HP가 줄어들어요

by 강릉바다의 블로그 2022. 10. 6.

local player = script.Parent
local humanoid = player:FindFirstChild("Humanoid")
local deBounce = false

function lavaTouch(part)
	if humanoid.FloorMaterial ~= nil and humanoid.FloorMaterial.Name == "CrackedLava" then
		if not deBounce then
			deBounce = true
			humanoid:TakeDamage(10)
			wait(1)
			deBounce = false			
		end
	end
end

humanoid.Running:Connect(lavaTouch)

 


강릉바다의 블로그

Since 2008. 1.

https://gnbada.kr/