Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Does anyone know why my return script isn't working I've tried every method please help?

Asked by
JesseSong 3916 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

I was making my code but when I finished I checked everything and made sure the was no errors and I was watching tutorials on YouTube on how to fix this script if you know please help me What do I have to do to make this script run propely?

Here the script:

function hello()
print ("hi")
print ("hi")
return (10)
end
hello()

0
What do you think return does? oreoollie 649 — 5y

2 answers

Log in to vote
0
Answered by
thesit123 509 Moderation Voter
5 years ago

What do you need to return? Do you want to print 10, after printing 'hi' twice?

And you need to put local in front of the function.

local function hello()

    print ("hi")

    print ("hi")

    return (10)

end

print(hello())

--[[ Output:

hi
hi
10

]]--
0
So in every function do you have to have the word "local" and in every variable? JesseSong 3916 — 5y
0
yes, unless you are doing a module script. But don't get into that yet. thesit123 509 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

This repeats it.

on = true
-----------------
if script.Disabled == false then
    repeat
        print("Hello")
        wait(1)
    until
    script.Disabled == true
end

This is what disables the script after ten seconds.

wait(10)
script.Disabled = true

You could also do this and it'll pop up with a number next to it to tell you which one it is instead of the x2.

for hello = 1,10,1 do
    print("Hi",hello)
    wait(0.5)
end

Answer this question