d_vone
(Mustang)
June 27, 2021, 8:34pm
#1
I’m completely unsure why this script doesn’t work. I’ve looked up multople posts with this exact same issue and the issues and solutions are nearly identical?
local count = char.Count.Value
while wait(1) do
count = count + 1
print(char.Count.Value)
end
I’ve made sure “count” is indeed an int value. Is this because the int value is inside the character? I’ve recreated this exact script with a different int value and it seems to work. I’m stumped.
1 Like
LarvusIV
(Larvus)
June 27, 2021, 8:36pm
#2
Not sure, maybe do a repeat until statement with something like:
repeat
wait(1)
count = count + 1
print(char.Count.Value)
until count.Value = (number to end at)
if you are doing a while true do statement and want it to end at a certain number, do:
while wait(1) do
count = count + 1
print(char.Count.Value)
if count.Value == whatever number then
break
end
or something like that
flkfv
(flkfv)
June 27, 2021, 8:36pm
#3
Your increasing a variable, try this instead.
local count = char.Count
while wait(1) do
count.Value = count.Value + 1
print(char.Count.Value)
end
1 Like
This should be the answer, You can also write it shorter
local count = char.Count
while wait(1) do
count.Value += 1
print(count.Value)
end
2 Likes
SelDraken
(SelDraken)
June 27, 2021, 8:39pm
#5
while wait(1) do
char.Count.Value = char.Count.Value + 1
print(char.Count.Value)
end
SelDraken
(SelDraken)
June 27, 2021, 8:39pm
#6
lol, beat me to it, you have some fast typing skills
1 Like
Palms are sweaty, Copy pasta, Moms spaghetti
d_vone
(Mustang)
June 27, 2021, 8:40pm
#8
Although this prints the correct number, it does not increase the int value.
d_vone
(Mustang)
June 27, 2021, 8:44pm
#9
Could you link the api for “+=”? I cant find it sorry…
LarvusIV
(Larvus)
June 27, 2021, 8:44pm
#10
Maybe just make the count variable to
local count = char.Count.Value
into
local count = char.Count
so that in the while do statement, you can do count.Value = count.Value + 1
just a suggestion, if not than i can figure something out
1 Like
Its general code syntax and is used all around different languages. I recommend checking out this link
Additional info
+= is not defined in the first link. You can read more on it here
Look for lua_CFunction
for an example
1 Like
d_vone
(Mustang)
June 27, 2021, 8:45pm
#12
Yes this is what I did, thank you <3
1 Like
LarvusIV
(Larvus)
June 27, 2021, 8:46pm
#13
np! gl with what you are working on!
1 Like