pls help i need this for my game, when your health is 10 it tween start
and i dont know how to make it
https://gyazo.com/1f89e356cee254d54ae53659f986b010
I’ll assume you know how to tween.
Just play a tween like normal, BUT in TweenInfo you must set Repeat count as -1
local tweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
iguess u can use
repeat [tween] wait() until [boolvalue of health] > 10 end
Use
local goal = {}
goal.size = UDim2.new(0.5, 0, .5, 0)
local tweenInfo = TweenInfo.new(1) -- the time it takes for the tween
local tween = TweenService:Create(gui, tweenInfo, goal) --gui is the gui
instead. this allows you to do
-- the "tween" var is the tween's variable
tween.Completed:Wait()
, so the tweens dont interupt each other.
Building onto @cureog’s, do
-- put in localscript in HeartLogo
local debounce = false
game.Players.LocalPlayer.Character.Humanoid.HealthChanged:Connect(function(healthNow)
if healthNow <= 10 and debounce == false do
debounce = true
while game.Players.LocalPlayer.Character.Humanoid.Health <= 10 do
local goal = {}
goal.size = UDim2.new(1, 0, 1, 0)
local tweenInfo = TweenInfo.new(.5)
local tween = TweenService:Create(script.Parent, tweenInfo, goal)
tween.Completed:Wait()
goal.size = UDim2.new(0.5, 0, .5, 0)
tween = TweenService:Create(script.Parent, tweenInfo, goal)
tween.Completed:Wait()
end
debounce = false
end
end)
untested, be careful.
i tried everything and is still didnt work
Even this one? i just posted it. If there are any typos, it’s because I typed it in under a minute (debatable) lol
yes it didnt work even theres no errors
Can you send a recording with the output open?
Side Note: changing your health via properties only does that on the client, not the server.
Hmm… could I see the explorer layout?
wait im an idiot i forgot to enabled
Ahhhh. Might it be that I put
?
It should be
goal.Size = UDmi2...
.
Edit: Nvm, seems like you got it. Hope this helps you.
now i got an error
what line? the camera cropped it off. - Client -
…
Edit: maybe there should be a “WaitForChild
” instead of the dot operator?
the code
-- put in localscript in HeartLogo
local debounce = false
game.Players.LocalPlayer.Character.Humanoid.Changed:Connect(function(healthNow)
if healthNow <= 10 and debounce == false then
debounce = true
while game.Players.LocalPlayer.Character.Humanoid.Health <= 10 do
local goal = {}
goal.size = UDim2.new(0.2, 0, 1.055, 0)
local tweenInfo = TweenInfo.new(.2)
local tween = TweenService:Create(script.Parent, tweenInfo, goal):Play()
tween.Completed:Wait()
goal.size = UDim2.new(0.155, 0, 1, 0)
tweenInfo = TweenInfo.new(.2)
tween = TweenService:Create(script.Parent, tweenInfo, goal):Play()
tween.Completed:Wait()
end
debounce = false
end
end)
On line 4, try
game.Players.LocalPlayer.Character:WaitForChild('Humanoid'). HealthChanged:Connect(function(healthNow)
instead.
i got another error yey
oy vey
Lines 11-12 and 16-17, try
local tween = TweenService:Create(script.Parent, tweenInfo, goal)
tween:Play()
tween.Completed:Wait()
??