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

How do i make a script that load text from pastebin?

Asked by 6 years ago

How do i make a script that load text from pastebin? what i need help with was if the text in the textbox matches text from pastebin text trigger the script

1 answer

Log in to vote
3
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

You can use HttpService:GetAsync(). Note that you must use it in a server script.

An example:

Server:

local url = "http://pastebin.com/raw/blabla"
local pastebinText = game:GetService("HttpService"):GetAsync(url, true) --the "true" as 2nd argument is to prevent it from caching the response, although I guess its not necessary here

local remoteFunc = Instance.new("RemoteFunction", game:GetService("ReplicatedStorage"))
remoteFunc.Name = "TextRemote"
remoteFunc.OnServerInvoke = function(plr, text)
    return text == pastebinText
end

Client:

local remoteFunc = game:GetService("ReplicatedStorage"):WaitForChild"TextRemote"
local textBox = script.Parent.TextBox
local textButton = script.Parent.TextButton

textButton.MouseButton1Click:Connect(function()
    local isValid = remoteFunc:InvokeServer(textBox.Text)
    print("The text is",isValid and "valid" or "invalid")
end)
0
I was wondering about that too. DeceptiveCaster 3761 — 6y
0
Thanks JohnnyTheGamer_YT -17 — 6y
0
Can you explain me more in discord? JohnnyTheGamer_YT -17 — 6y
Ad

Answer this question