Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- HOW TO MAKE HIT-TO-DESTROY Part!!! Roblox Studio Tutorial youtube.com/c/BloxianCode
- Tutorial: https://youtu.be/OjFsEDZEK5A?si=r4eGEbWWw_pHhmL4
- Don't touch the model or script unless you know what you are doing
- Watch the video for more info https://youtu.be/OjFsEDZEK5A?si=r4eGEbWWw_pHhmL4
- ]]
- local gr = Color3.fromRGB(56,255,12)
- local red = Color3.fromRGB(255,0,4)
- local canTouch = true
- local partH = 100
- script.Parent.Touched:Connect(function(hit)
- if hit.Parent.Name == "ClassicSword" and canTouch == true then
- canTouch = false
- partH = partH -10
- script.Parent.BillboardGui.TextLabel.Text = "Health: "..partH.."%"
- script.Parent.BillboardGui.TextLabel.BackgroundColor3 = red:lerp(gr, partH / 100)
- if partH == 0 then
- script.Parent.BillboardGui.TextLabel.Text = "Destroying..."
- wait(2)
- script.Parent:Destroy()
- end
- wait(1)
- canTouch = true
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment