Script Roblox Studio

 Script Roblox Studio Karakter Mati Saat Terjatuh Dari Ketinggian


local Root = script.Parent:WaitForChild("HumanoidRootPart")

local Humanoid = script.Parent:WaitForChild("Humanoid")

local Enable = false

local EndPosition = 0


Humanoid.StateChanged:Connect(function(oldState, newState)

if newState ~= Enum.HumanoidStateType.Freefall then

Enable = false

end

end)


function onFreeFall()

print(Root.Position.Y)

EndPosition = Root.CFrame * Vector3.new(0, -Humanoid.JumpPower, 0)

print(EndPosition.Y)

Enable = true


while Enable == true do

wait(0.01)

if Root.Position.Y <= EndPosition.Y then

Humanoid.Health = 0

end

end

end


Humanoid.FreeFalling:connect(onFreeFall)


Komentar

Postingan populer dari blog ini

Desain Pemodelan Grafik (Tugas1)

Pengantar Komputasi Modern - Tugas 2

Peran Mahasiswa Terhadap Perubahan Sosial