All Questions
422
questions
1
vote
1
answer
29
views
Exp bar Gui not updating roblox studio
I have set up a basic exp system with exp, levels, and a Gui. I have the gui set to update when joining, and when gaining exp or a level, but it will only update when joining even though I'm using the ...
0
votes
2
answers
38
views
Add a docstring to a lua function in Roblox Studio
I want to create a docstring for a Lua function in Roblox Studios so that when i look at that function that i instantly know what this function does.
And currently the Popup looks like this:
But the ...
0
votes
0
answers
98
views
DRY: don't repeat yourself in Lua
There is a way to not rewrite the same part (the cycle for i = 1...end) twice?
local function myfunc(frame,method)
if frame:IsShown() then
for i = 1, #frame.buttons do
frame....
0
votes
0
answers
45
views
How useful is it to make a global function fire a larger local function?
So, this is the thing. In my local script, i've got a global function which recognizes when the user is holding down a key and sets to true a boolean that fires a local function, which is VERY large.
...
0
votes
1
answer
54
views
How to save a function of an Object/table to a variable to be called from this variable in Lua?
I'm experimenting with Lua OOP (Object Oriented Programming) but I'm experiencing some issues.
Here is a sample code with comments:
Object = {string = "Default"}
function Object:new()
...
0
votes
2
answers
295
views
Lua: Function to Change Value in Dictionary
I want to create a function to change a value in Dictionary. I came up with something really complicated. It works, but it also adds additional output I can't explain.
boolValues = {
firstBool=...
2
votes
1
answer
65
views
Is there a difference between global require and local require within a function
AFAIK, once the module has been loaded, lua caches the result into package.loaded[modName]. Does this statement hold true irrespective of where we are doing require "module"?
Following ...
3
votes
1
answer
50
views
Is there a way to tell the difference between a parameter in a function being omitted, and the parameter being passed being nil?
Let's say I have a function that returns a Boolean value, and I have a function that sets an override so that the first function always returns a specified Boolean. The second function looks something ...
0
votes
0
answers
27
views
Collision doesn't work in love2d what to do?
The collision of river is not working, its just an if statement where i've written the coordinates of river when the frog collides with those coordinates it should change the state. When frog collides ...
0
votes
1
answer
210
views
How to "pass around" function environments with local variables in Lua
Please consider the following snippet of code.
-- file A.lua
function A()
local x = 1
local y = 2
if ... then
--super hidden code that should not be seen
x += 1
y +=...
3
votes
2
answers
429
views
What does `load` do with chunk as function in Lua
There is load function that compiles chunk if chunk is string. But i don't understand, what does it do with function.
They said:
If chunk is a function, load calls it repeatedly to get the chunk ...
0
votes
1
answer
703
views
How to tell when a player has stopped touching a part (Roblox Studio)
With help from phloem I was able to make a region 3 script that detects when the player is inside it and it looks like this,
while true do
wait(1)
local partsInregion = game.Workspace:...
0
votes
0
answers
22
views
Breaking out of a function with :connect using an if condition
I'm trying to use a boolean variable enterFinished to break out of the of the function keypad once the enter.MouseClick:connect() is finished.
function keypad(state)
local enterFinished = false
...
1
vote
0
answers
100
views
Lua - Appending function properly
First I defined the AppendScript function
local mt = {
AppendScript = function(self, handler, method)
local func = self:GetScript(handler)
self:SetScript(handler, ...
0
votes
2
answers
702
views
Can anyone help me with my "GnomeCode" Script? The error message I get states the following:
18:13:51.541 Infinite yield possible on 'ReplicatedStorage.Events:WaitForChild("GetData")' - Studio
18:13:51.541 Stack Begin - Studio
18:13:51.541 Script 'ServerScriptService....