Does anyone know why this function in my dialog module script doesnt work/call?
Here is the module script inside of the npcs:
[3] = {
Text = "first, it requires atleast 10k Cash.";
ByeBTNMessage = "im broke.";
Choices = {
[1] = { Text = "yeye i have your money."; Next = 4; Follow = true};
};
funct = function()
print("cash check here?")
end;
};
here is the local script
if dialog.funct then
print("function dialog play?!?!")
dialog.funct()
end
the issue is that the function doesnt call thats the only problem (also when i print out “dialog” it shows everything except the “funct”)
Are you using a require
or is there a remote event?
remote event
Dont read this just 30 thingy
Tubbes1
(KarilbolCoolCold)
August 22, 2023, 8:33pm
#4
you’re supposed to use require() to get the function from the ModuleScript.
i require it in another script and fire a remote even to pass it if that make sense (and plus everything else works besides the function)
bytesleuth
(bytesleuth)
August 22, 2023, 8:46pm
#6
Could we see some more code? For example, what is dialog?
Remote functions cannot send functions to the client.
Angermode
(Angermode)
August 22, 2023, 9:30pm
#8
Example code:
--Module script
local data = {
[3] = {
Text = "first, it requires atleast 10k Cash.";
}
}
function data.GetTextFromTable(index)
local entry = data[index]
if entry then
return entry.Text
else
return "Invalid index"
end
end
return data
-- local script
local dataModule = require(game.ReplicatedStorage.dataModule)
print( dataModule.GetText(3) )