local function click()
if plusPower.Value == 0 then
plusPower.Value = 1
print(plusPower.Value)
elseif plusPower.Value >= 1 then
load:Play()
local function getPowerTween()
local textClone = player.PlayerGui.UnderGui.plusPower:Clone()
textClone.Name = "TextClone"
textClone.Parent = player.PlayerGui.UnderGui
textClone.Text = "💪+".. plusPower.Value
local Info = TweenInfo.new(0.6)
local Tween = tween:Create(textClone, Info, {TextTransparency=0})
local Tween2 = tween:Create(textClone.UIStroke, Info, {Transparency=0})
local Tween3 = tween:Create(textClone, Info, {Position = player.PlayerGui.UnderGui.Strength.Position})
Tween:Play()
Tween2:Play()
textClone.Position = UDim2.new(math.random(1, 6) / 10, 0, math.random(15, 75) / 100, 0)
wait(0.4)
Tween3:Play()
wait(0.2)
textClone:Destroy()
end
getPowerTween()
power.Value = power.Value + plusPower.Value
load.Stopped:Wait()
end
end
So here I have a function that I call when you click on the left mouse button, but the problem is that when you quickly click on the button the player quickly plays the animation and quickly gets the power. The question is how to deprive him of this opportunity?
Not sure if this is helpful to your question, but I think you need to add a delay / time it plays the tween so it matches with the wait time.
For example:
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
)
local tween = TweenService:Create(part, tweenInfo, { Position = Vector3.new(0, 30, 0) })
tween:Play()
task.wait(10)