The issue is, the thing wont even function at all when i click it. Basically what i'm trying to make is a "Contest" system. If you click the button, it will put your username in the table and change the "Participants:" text and will add your username in it too. It doesn't send errors or anything, it just doesn't function. Please fix, would be appreciated.
local ParticipantSign = game.Workspace.Participants.SurfaceGui.Text local DatastoreService = game:GetService("DataStoreService") local Participants = DatastoreService:GetDataStore("Participants") local ParticipantsTable = {} function OnClicked(player) for i, v in pairs(ParticipantsTable) do if v == player.Name then print(ParticipantsTable.." nah you're in it") return else Participants:GetAsync(player.Name) table.insert(ParticipantsTable, player.Name) print(ParticipantsTable.. " yes it worked") ParticipantSign.Text = ParticipantSign.Text..player.Name..", " end end end script.Parent.ClickDetector.MouseClick:Connect(OnClicked)
On line 14, you are using table.insert
without providing the table for it. Change it to this and it should work:
table.insert(ParticipantsTable, player.Name)