How to put a space in a module function name

what am i trying to do is putting a space within the module function name
like this image
it aint working at all

1 Like

Rather than having a space, put an underscore instead like so: Stand_Summon

Or name it standSummon()
(its better I promise)

Function names cannot have spaces. Use an underscore or some typing method like camel case.

This does work (or it at least should) with key/value pairs in a dictionary where the key is a string and the value is an anonymous function of some kind, however:

local funcs = {
  ["My Function"] = function(str) print(str) end
}

funcs["My Function"]("Hello world!") 

-- Outputs "Hello world!"
1 Like

If you really need the space, you’d have to do something like this:

local module = {
    ["Stand Summon"] = function(Player, Value, Name, Count)
        -- code
    end
}
1 Like

I think this is what you are looking for:

module["Stand Summon"] = function(Player, Value, Name, count)
	-- code here
end

-- call the function in a script like this:
module["Stand Summon"](Player, Value, Name, count)
1 Like

i mean yea but all the names in my game is Stand Summon not StandSummon cuz its for naming things like cooldowns

It’s very strange to have spaces in your function names. If you gave this code to someone else, it would be very confusing. If it was normal to do this, you would know how already.

1 Like

You can remove the space from the string when you need to run the function

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.