#Repeat until working weirdly
195 messages · Page 1 of 1 (latest)
this is my repeat loop thing for whenever i press the button
if CanUseMove then
repeat
print("a")
task.wait(cooldown/64)
script.Parent.Parent.Transparency = .5
script.Parent.Parent.Size = script.Parent.Parent.Size - UDim2.new(0,0,0,1)
if script.Parent.Parent.Size.Y.Offset <= 1 then
print("aaaaaa")
script.Parent.Parent.Size = UDim2.new(0,64,0,64)
script.Parent.Parent.BackgroundTransparency = 1
break
end
until not CanUseMove
return false
end
** You are now Level 1! **
do u ever update CanUseMove tho
its repeating untill not CanUseMove
ye
and u never changing it
im changing it in a different script
since this is in a module
show me where u made the variable
so srry if i dunno
the local
kk
yea yea
alr
but dont think the variable is modular tho
yea so
btw i only made the module to try and fix the issue
tell me part where it sets CanUseMove to false or nil
bro i am a dumb ahh
lol
i forgot to add it back in
but
hold on
lemme see if it works tho
wait no
it does upd
so it works or no
in line 32 it sets the cooldown back to false
because this returns false
oh shi
basically the part that says
GroundBoomCooldown = modf.Repeatable(2, GroundBoomCooldown)
my ahh is dumber than the 3rd grader coding on scratch ngl
if u are talking about return false part, all it does is stops script from running (which nothing in this case) and will set GroundBoomCooldown to the return, so false
** You are now Level 2! **
even without the module script
i had the entire thing in the local script
the same bug was going on
put it back onto local script
and same issue is going on
not sure what the issue is now tho
yeah thats why
this does check for if the cooldown is false or not
and it should stop accordingly, no?
not only that, but whenever the loop ends it should not restart
it does print after the loop ends
yeah exactly what i was thinking
hold on lemme give some better explanations since i am only giving some brief sentences
UIS.InputBegan:Connect(function(key, typing)
if not typing then
if key.KeyCode == Enum.KeyCode.One then
if GroundBoomCooldown == false then
--(in this part its where it checks whether the cooldown)
game.ReplicatedStorage.Remotes.Attack:FireServer("SwordAreaGrounder")
game.ReplicatedStorage.Remotes.Attack.OnClientEvent:Connect(function(cooldown, move)
if cooldown == false and move == "SwordAreaGrounder" then
GroundBoomCooldown = false
elseif cooldown == true and move == "SwordAreaGrounder" then
--(checks for if u can do the move)
GroundBoomCooldown = true
script.Parent.Size = UDim2.new(0,64,0,64)
print("grgrgrgr")
repeat
print("a") --(this is to check for each loop)
task.wait(2/64)
script.Parent.Transparency = .5
script.Parent.Size = script.Parent.Size - UDim2.new(0,0,0,1)
if script.Parent.Size.Y.Offset <= 1 then
print("aaaaaa") --(this works in the code, it checks if the size has reached the goal)
script.Parent.Size = UDim2.new(0,64,0,64)
script.Parent.BackgroundTransparency = 1
GroundBoomCooldown = false --(this does as it says)
end
until GroundBoomCooldown == false --(again)
print("bababaa") --(checks for if the loop has ended or not)
end
end)
end
end
end
end)
i put some comments
here and there
alr
i dont see the bug
basically there is a button that the player presses
and the gui has a red background that shrinks according to the cooldown
thats it
the repeat loop just doesnt end (i think thats the issue)
because if the player presses the button again
so loop only runs once
wait
im not using the module anymore
since
it wasnt really
neccessary
let me see
just say whats the issue
im as confused as u are rn
the repeat until loop doesnt end
** You are now Level 3! **
it works the amount of times u've pressed it in total
i am deeply sorry for my horrible explanations btw
k
i will give u the whole script this time
`local player = game.Players.LocalPlayer
local char = player.Character
local UIS = game:GetService("UserInputService")
local modf = require(script.ModuleScript)
local GroundBoomCooldown = false
UIS.InputBegan:Connect(function(key, typing)
if not typing then
if key.KeyCode == Enum.KeyCode.One then
if GroundBoomCooldown == false then
game.ReplicatedStorage.Remotes.Attack:FireServer("SwordAreaGrounder")
game.ReplicatedStorage.Remotes.Attack.OnClientEvent:Connect(function(cooldown, move)
if cooldown == false and move == "SwordAreaGrounder" then
GroundBoomCooldown = false
elseif cooldown == true and move == "SwordAreaGrounder" then
GroundBoomCooldown = true
script.Parent.Size = UDim2.new(0,64,0,64)
print("grgrgrgr")
--GroundBoomCooldown = modf.Repeatable(2, GroundBoomCooldown)
repeat
print("a")
task.wait(2/64)
script.Parent.Transparency = .5
script.Parent.Size = script.Parent.Size - UDim2.new(0,0,0,1)
if script.Parent.Size.Y.Offset <= 1 then
print("aaaaaa")
script.Parent.Size = UDim2.new(0,64,0,64)
script.Parent.BackgroundTransparency = 1
GroundBoomCooldown = false
end
until GroundBoomCooldown == false
print("bababaa")
end
end)
end
end
end
end)`
that
looks weird
.
i dont see pressed code
??
o
right
i explained it
wrong
again
u press a key and it does
that
oh
man im so sorry for bothering u this much
ye
and the rest of code triggers from remote on client
ye
alr
just random idea
a check to see if cooldown is true or false?
ngl
im dumb at times
dont answer it
u gotta be fucking kidding me
a solution
was just
a
if cooldown = false
thank you bro
dang