블록에 닿을 때 체력이 줄어듭니다.
아주 간단하지만, 사실 모든 것의 기본입니다
local box = script.Parent
local function onTouched(hit)
print ("Touched")
local humanoid = hit.Parent:FindFirstChild('Humanoid')
if humanoid then
print(humanoid.health)
humanoid:TakeDamage(10)
end
end
box.Touched:Connect(onTouched)
'Roblox Script' 카테고리의 다른 글
#13 : 따라오는 NPC - npc following (0) | 2020.08.06 |
---|---|
#12 : 총만들기 (인증 Weapons Kit 사용하기) (0) | 2020.08.06 |
#11 : 그룹에 따라 팀 나누기 (Team by Group) (0) | 2020.08.06 |
#10 : 플레이어 머리에 이름 표시 - Player Title (Team / Role) BillboardGui (0) | 2020.08.06 |
#9 : RemoteEvent로 Sever에서 local function 호출 (0) | 2020.08.06 |