#HELP how to make it smoother??

9 messages · Page 1 of 1 (latest)

zenith crag
#

u could do this:

local htable = {["1"] = {Range = 1,2,3,4,5,6,7,8,9,10, PlaybackSpeed = 1.8}, ["2"] = {Range = 11,12,13,14,15,16,17,18,19,20, PlaybackSpeed = 1.6},  ["3"] = {Range = 21,22,23,24,25,26,27,28,29,30, PlaybackSpeed = 1.5},  ["4"] = {Range = 31,32,33,34,35,36,37,38,39,40, PlaybackSpeed = 1.4},  ["5"] = {Range = 41,42,43,44,45,46,47,48,49,50, PlaybackSpeed = 1.25},  ["6"] = {Range = 51,52,53,54,55,56,57,58,59,60, PlaybackSpeed = 1.1},  ["7"] = {Range = 61,62,63,64,65,66,67,68,69,70, PlaybackSpeed = 1},  ["8"] = {Range = 71,72,73,74,75,76,77,78,79,80, PlaybackSpeed = .9},  ["9"] = {Range = 81,82,83,84,85,86,87,88,89,90, PlaybackSpeed = .8},}

while true do
    task.wait()
    if hum.Health < 100 then
        for i,v in pairs(htable) do
            if table.find(v, math.floor(hum.Health)) then
                hb:Play()
                hb.PlaybackSpeed = v.PlaybackSpeed
                hb.Ended:Wait()
            end
        end
    end
end

dont mind the REALLY long table

covert seal
#

instead of a while true do loop, why dont u just check whenevber humanoids health changes

rigid fulcrumBOT
#

studio** You are now Level 1! **studio

covert seal
#

i think so

#

idk

vague furnace
vague furnace
# covert seal i think so

--heartbeat 
hum:GetPropertyChangedSignal("Health"):connect(function() -- OR hum.HealthChanged:connect(function()
local hb = script.SFX:FindFirstChild("Heartbeat")
task.wait()
if hum.Health >= 0 and hum.Health < 100 then
    for i,v in pairs(htable) do
        if table.find(v, math.floor(hum.Health)) then
            hb:Play()
            hb.PlaybackSpeed = v.PlaybackSpeed
            hb.Ended:Wait()
            end
        end
    end
end)```

i am trying to only call the function whenever the health changes but it plays too fast lol, i'll use while true do loop instead, thanks a lot too! :>