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

What's wrong with this 8-Line script?

Asked by 4 years ago
Edited 4 years ago
link = "https://pastebin.com/raw/CU06Tjg4"
reason = "Updates."
while true do
    wait(1)
    if string.gsub(game.HttpService:GetAsync(link), " ", "") == "true" then
        for _, x in pairs(game.Players:GetPlayers()) do x:Kick(reason) end
    end
end

I use pastebin to shutdown servers, but sometimes it doesn't work. I made it print the text of the link in the output, and when it didn't work it printed: https://pastebin.com/raw/PgpqzQfn instead of true.

0
That looks like HTML to me. Would you mind posting it on Pastebin? Sonnenroboter 336 — 4y
1
Why are you doing hs:GetAsync("Shutdown for updates")? "Shutdown for updates is not a valid link programmerHere 371 — 4y
0
you can shut down the server from the games page surely ? royaltoe 5144 — 4y
0
View all comments (3 more)
0
@programmerHere I had it also checking a pastebin link for the reason, but decided not to and forgot to remove that part. I fixed it but im still having my original problem ShadyShock 77 — 4y
0
@royaltoe, Ok, but now that this is not working I'm curious as to why ShadyShock 77 — 4y
0
Your pastebin of the HTTP response shows that pastebin rejected your attempt to fetch the page, CloudFlare (an anti-DDoS provider Pastebin uses) blocked it. This system is never going to work reliably unless you set up your own webserver. But now MessageService is a thing, you should probably just use that if you need more control than using Shutdown All Servers from your game page. EmilyBendsSpace 1025 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Hello, you should probably use string.find().

link = "https://pastebin.com/raw/CU06Tjg4"
reason = "Updates."
while true do
    wait(1)
    if string.find(game.HttpService:GetAsync(link), "true") then
        for _, x in pairs(game.Players:GetPlayers()) do x:Kick(reason) end
    end
end

Please upvote if this works, Thank you.

Ad

Answer this question