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

Events Fire but the OnServerEvent Fucntion doesnt work?

--Module Script
server = nil 
service = nil
local settings = require(game.Workspace.ApplicationLoader.Settings)
local event1	= Instance.new("RemoteEvent",workspace)
event1.Name 		= "toTrello"
local event2 	= Instance.new("RemoteEvent",workspace)
event2.Name 	= "StoreData"


local List_Name1 = "Applications"

local Answers = {}

return function()
	local board = server.Setting.Trello_Primary
	local appkey = server.Settings.Trello_AppKey
	local token = server.Settings.Trello_Token
	local trello = server.HTTP.Trello.API(appkey,token)
	local lists = trello.getLists(board)
	local logList1 = trello.getListObj(lists,{tostring(List_Name1)})
	event1.OnServerEvent:connect(function(player,message)
		trello.makeCard(logList1.id,player.Name,tostring(table.concat(Answers,"\n")..message))
	end)
	event2.OnServerEvent:connect(function(player,message)
		table.insert(Answers,message)
	end)
end



The event fires in the local script but the OnServerEvent never works... Idk why..

--Local Script
game.workspace:WaitForChild('StoreData')
local event = game.Workspace.StoreData
game.Workspace:WaitForChild('toTrello')
local event2 = game.Workspace.toTrello
game.Workspace:WaitForChild('ApplicationLoader')
local settings = require(game.Workspace.ApplicationLoader.Settings)
guiname = script.Parent.Parent
script.Parent.MouseButton1Click:connect(function()
	if guiname.Name == tostring(#settings.Questions) then
		game.Workspace.toTrello:FireServer('-DevBot')
		print("2")
	else
		game.Workspace.StoreData:FireServer('['..tostring(script.Parent.Parent.Background.Question.Text)..'] Answer: '..tostring(script.Parent.Parent.Background.TextBox.Text))
		guiname.Visible = false
		local this = script.Parent.Parent.Name
		local NextUI = script.Parent.Parent.Parent[tostring(tonumber(this + 1))]
		NextUI.Visible = true
		print("1")
		if NextUI.Name == tostring(#settings.Questions) then
			NextUI.Next.Text = "Submit"
		end
	end	
end)

Can someone please help me.. This is also (FE) Filtering enabled

1 answer

Your module returns a function that sets up Trello communication (by the looks of it). This means that the events will only be setup when you have required the ModuleScript and called the function it returns. You probably want to just run the function on the server automatically, in which case you should convert it into a Script.

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