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

[TrelloAPI] Why is my FeedBack GUI not sending cards to my board?

Asked by 8 years ago

With the TrelloAPI, I created a feedback GUI where players can type a message, and send it to my private Trello board. It worked fine, but on Trello, it wasn't getting the username, and it ended up with Sent By: Players. I wanted to get the full username, or rather, the author of the message. (The token works already, as well as the boardID, listID, and cardID.)

Here is my code found in a TextButton that sends anything that is written in a TextBox to a new card in a list on my Trello board:

ap = require(script.Parent.Parent.Parent.TrelloAPI)  

local Board = ap:GetBoardID("myboard")
local List = ap:GetListID("test1",Board)
local count = false

script.Parent.MouseButton1Down:connect(function()
    if count == false and script.Parent.Parent.TextFrame.TextBox.Text ~= "Type here..." then
        wait(2)
        ap:AddCard(script.Parent.Parent.TextFrame.TextBox.Text,"Sent by: "..game.Players.LocalPlayer.Name,List,"","top")
        script.Parent.Parent.TextFrame.TextBox.Text = "Type here..."
        count = true
        for i = 240, 0, -1 do --240 seconds per feedback
            script.Parent.Parent.TextTimer.Text = "You can post a comment in: "..i
            wait(1)
        end
        count = false
        script.Parent.Parent.TextTimer.Text = "You can post a comment every 4 mins"
    else
        script.Parent.Parent.ReactionSound:Play() wait(.15) script.Parent.Parent.ReactionSound:Play()
    end
end)

When I typed in some random words and hit the Send button, nothing happened. I checked the ROBLOX Developer Console (F9) and I saw this:

Players.TegraDash.PlayerGui.ScreenGui.FeedBackFrame.Enter.Script:10: attempt to index field 'Local Player' (a nil value)

Here is Line 10, same script as above:

ap:AddCard(script.Parent.Parent.TextFrame.TextBox.Text,"Sent by: "..game.Players.LocalPlayer.Name,List,"","top")

This line adds the Sent by: (player name) to the card description.

I converted it from a regular script to a Local Script to see if that solved my problem. I tested it in Studio. It worked fine. I published the game, did the same test, and it did nothing. There was no error message in the console either.

Can anyone explain the discrepancies in this?

0
Hmm... This sounds weird. Maybe you could fix it by having a player write their name into a TextBox? Or, you could just go gui.Parent until you get to their Player, cause guis are stored in a child of a Player. TheDeadlyPanther 2460 — 8y
1
You can ONLY use LocalPlayer in a LocalScript, not a Server-Sided script. I will have to check but I believe HttpService requires a server-sided script to work. So you will probably need a RemoteEvent for your script to work. M39a9am3R 3210 — 8y
0
Sorry this isn't exactly constructive, but can you link me to that API? I want people to be able to be able to view progress on my games, while they're playing them. yumtaste 476 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

"I converted it from a regular script to a Local Script to see if that solved my problem. I tested it in Studio. It worked fine. I published the game, did the same test, and it did nothing. There was no error message in the console either."

The reason for this is that, when testing, you are both the server and the client simultaneously, whereas when you're online, you are only the client and the server is on one of Roblox's computers.

LocalScripts only run on the client and Scripts only run on the server. Thus, as M39a9am3R says, you need to use a RemoteEvent or RemoteFunction (see Roblox API) to communicate what the client wants to the server. The server should then make sure the request is valid (ie not an exploiter/hacker sending illegal requests), and - if it's a good request - then send it off to Trello as you're doing now.

Ad

Answer this question