i want to print simple true or false from ModuleScript and for some reason don’t work
i appreciate a lot if someone can help me.
ModuleScript:
local module = {}
function module.Event()
local event = game:GetService("ServerStorage").MoveButton
print("Before Fire")
event:Fire(true)
print("After Fire")
end
return module
ServerSide:
local Test = require(game:GetService("ServerScriptService").ModuleScript)
local Event = game:GetService("ServerStorage").MoveButton
Test.Event()
print("Before Event")
Event.Event:Connect(function(bool)
if bool == true then
print("You Are "..bool)
elseif bool == false then
print("You Are "..bool)
end
end)
print("After Event")
It seems like you are firing the event before you listen to the event.
Try moving Test.Event() under your event listener.
local Test = require(game:GetService("ServerScriptService").ModuleScript)
local Event = game:GetService("ServerStorage").MoveButton
print("Before Event")
Event.Event:Connect(function(bool)
if bool == true then
print("You Are "..bool)
elseif bool == false then
print("You Are "..bool)
end
end)
Test.Event()
print("After Event")