scripts shouldn't be more complicated than they need to be, but if you're really looking to complicate your script, here's an example:
like you said in your example, you can perform complicated math on some things. For example, this script creates parts faster the higher you set the number.
local speed = 10
local speedformat = ((math.sqrt(5/speed)*(speed*2)/speed)/speed*10)
print(speedformat)
function makepart()
local part = Instance.new("Part", workspace)
end
while wait(speedformat) do
makepart()
end
also, here's a quick explanation of string.sub since you said you didn't get it:
string.sub takes a string, and cuts it down to a certain part, defined by 2 numbers. For example, this script takes whatever word you type in, and prints the first two letters:
local word = "Hello"
print(string.sub(word, 1, 2))
The first part is the string, the second part is the letter the new string starts at, and the third part is where the new string ends at. ("Hello", 2, 4) would return "ell" because E is the second letter (2, where it starts), and L is the fourth letter (4, where it ends).
1 comment
https://www.roblox.com/games/80960235 is uncopylocked, check the LocalScript in starterGui