--I've tried but this won't work.
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg:sub(1,2) == "h/" then -My chatted command game:GetService("HttpService"):GetAsync(msg:sub(3))-Gets any raw link when saying h/.
end
end)
end)
--What I want it to do is that whenever I type "h/" it sends the link back using the function getasync. And that means any link. That has roblox lua code in it.
COMMUNITY QUESTION
How would I make this http command work?
1 answer
Try this:
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg:sub(0,2):match("h/") then
game:GetService("HttpService"):GetAsync(msg:sub(3))
end
end)
end)
The issue was you were selecting only 1,2 of the message to select h/. I also changed it so that it uses a more reliable function called :match(), which matches any part of a string.
The string, or any string, when using :sub, starts at 0, then ends at the total length of the string.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This seems to work, but your comments need to have '--', not '-' before them.
No that was just for an explanation.