Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how to make a function happen when a variable is certian is set?

I've been working on a game and always get errors on this, youtube doesnt work.

level=1(function()
	script.Parent.Text="You Have Reached A Beginner Rank Keep Working To Level Up More Until Amature; Level: 15"
end)

2 comments

0

please post the entire script.

0

that is

1 answer

The easiest way is to set the variable inside the function, and then call the function when you want to set the level variable, like so:

-- Call this function when you want to set level
local function SetLevel(newLevel)
	level = newLevel
	script.Parent.Text="You Have Reached A Beginner Rank Keep Working To Level Up More Until Amature; Level: 15"
end

-- Calling the function
SetLevel(1)

1 comment

0

so does the function activate when the variable is 1?

This discussion is preserved as it was. New answers, comments, and votes are closed.