this is my code
http = game:GetService("HttpService") script.Parent.MouseButton1Down:Connect(function() pcall(function() local url = http:GetAsync(script.Parent.Parent.TextBox.Text,true) if url then loadstring(url)() else error(url) end end) end)
this code works normal in studio put shows no errors and does not work ingame
You’re using MouseButton1Click
on the server, when it’s client side only. loadstring()
is server side only, and so is the HttpService
. Use a RemoteEvent
and use the RemoteEvent.OnServerEvent
event to use the service.
--LocalScript local button = script.Parent local textBox = button.Parent.TextBox button.MouseButton1Click:Connect(function() game.Workspace.RemoteEvent:FireServer(textBox.Text) end)
Now the server side remote event.
local remote = game.Workspace.RemoteEvent remote.OnServerEvent:Connect(function(plr, url) local HttpService = game:GetService"HttpService" pcall(function() local theURL = HttpService:GetAsync(url, true) if theURL then loadstring(theURL) else error(theURL) end end) end)