So I am making a booking GUI to book tables etc, when the Submit button is clicked, it doesn’t fire the Remote Event in Replicated Storage, to test it, when it fires it is meant to print out “Fired”, but it doesn’t.
If it isn’t key that you use MouseButton1Click, then might I suggest using GuiButton.Activated? Also, remove the click event and see if it prints if you fire it without any trigger.
local Trello = require(script.Parent.Trello.Main)
local MainBoard = Trello:GetBoardByName("Redacted")
local Bookings = MainBoard:GetListByName("Bookings")
function getbookings() -- This Works
local bookings = Bookings:GetCards()
for i,v in pairs (bookings) do
local new = Instance.new("StringValue")
new.Parent = game.ReplicatedStorage.Bookings
new.Name = v:GetName()
new.Value = v:GetDesc()
end
end
print("Server Running") -- This Works
getbookings() -- This Works
while true do -- This Works
wait(15)
getbookings()
end
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Message == "make" then
local book = Trello.new("Card", "Test", Bookings)
book:SetDesc("Card made by: "..Player.Name.."\nTime: Test\nTable: 1")
end
end)
end)
game.ReplicatedStorage:WaitForChild("book").OnServerEvent:Connect(function(p, plr, tablee, timee)
print("Fired")
local book = Trello.new("Card", plr, Bookings)
book:SetDesc("Booking made by: "..p.Name.."\nTime: "..timee.."\nTable: "..tablee.."")
end)
while loops are blocking; they will yield the thread (script) until they complete the condition (this being true; meaning it will run forever).
Consider using courontines, a schedular, or move the while loop to the bottom of the code.
FWIW you also shouldn’t use Trello as a database; there’s a few other code smells but since it’s OT I’ll leave it to someone else to explain (feel free to DM me if you’d like more genera feedback on your code)