Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When the button is clicked, it doesn't function at all?

Asked by 4 years ago
Edited 4 years ago

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)
0
update: in line 14 even if i put table.insert(ParticipantsTable, player.Name), the button will still not function. Bloxwood1222 -3 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
0
the button still isn't functioning. Bloxwood1222 -3 — 4y
0
Does it print of any statements you put? XviperIink 428 — 4y
0
no. not even printing works Bloxwood1222 -3 — 4y
0
One question, why do you need a datastore for this? What's the point of it? XviperIink 428 — 4y
View all comments (5 more)
0
it's not for 1 server, its for all servers. thats why there's a datastore. Bloxwood1222 -3 — 4y
0
plus im kinda a beginner, so i dont know that much about scripting. Bloxwood1222 -3 — 4y
0
In that case, i would recommand messing sevice. Check it out here https://developer.roblox.com/en-us/api-reference/class/MessagingService XviperIink 428 — 4y
0
this might help. thanks Bloxwood1222 -3 — 4y
0
Nps XviperIink 428 — 4y
Ad

Answer this question