Hey all.
I’m looking for a solution so that when a python script is ran, containing the variable “scriptcontent”, then it will send the variable over to my ROBLOX game where it will run.
There would need to be people in the game.
Thanks all.
Hey all.
I’m looking for a solution so that when a python script is ran, containing the variable “scriptcontent”, then it will send the variable over to my ROBLOX game where it will run.
There would need to be people in the game.
Thanks all.
From my knowledge, I don’t believe there’s any kind of way to achieve this other than writing to a server from your python script, then having your Roblox game run an http request to grab that information.
I don’t know much about that, but other than that I really don’t think there’s a way to do what you’re asking.
I could be wrong though
If I understand the question right, you would most likely need something like FiOne. You could simply setup a webserver on python and make the Roblox server pull that website each second until it gets a response, and when it does make it run that code using FiOne.
Sounds relatively easy but you would also need a way to convert your source code into bytecode, this can be done using luac but you would need to run that in a subprocess and then read the output file.
Edit:
As @grilme99 said you can also use the loadstring
function assuming you are doing this only in your game, remember to enable the LoadStringEnabled
property under ServerScriptService for this to work.
Use GET requests using HTTPService! I’m personally using Django for this kind of stuff.
Here’s a (long) example:
local HTTPService = game.HttpService
local Multiplier = 5
local URL = "https://example.com/api_course?min=1&max=4&size=100"
local Response = HTTPService:GetAsync(URL)
local CourseData = HTTPService:JSONDecode(Response)
local Course = workspace.Course
local function ChangeColor(Part, Color)
Part.Color = Color
end
local function MakePart(i, j, CourseSection)
local Part = Instance.new("Part")
Part.Parent = CourseSection
Part.Anchored = true
Part.Position = Vector3.new(-2.5 + j * Multiplier - 1, 1, 0.5 - i * Multiplier - 1)
Part.Size = Vector3.new(Multiplier, 1, Multiplier)
return Part
end
for i = 1, #CourseData.course do
print(unpack(CourseData.course[i]))
local CourseSection = Instance.new("Folder")
CourseSection.Parent = Course
CourseSection.Name = i
for j = 1, #CourseData.course[i] do
if CourseData.course[i][j] == 1 then
MakePart(i, j, CourseSection)
elseif CourseData.course[i][j] == 2 then
local Part = MakePart(i, j, CourseSection)
Part.Name = "KillBrick"
ChangeColor(Part, Color3.fromRGB(255, 0, 0))
elseif CourseData.course[i][j] == 3 then
local Part = MakePart(i, j, CourseSection)
Part.Name = "RNGBrick"
ChangeColor(Part, Color3.fromRGB(9, 150, 200))
end
end
end
An interpreter would remove all optimisations from Luau. If this is being used for the developers personal game would it not be better to just use loadstring and then send the raw code?
Obviously loadstring is a better alternative but using an interpreter can be more secure than opening up the loadstring function as the game owner gets more control over who can use it and how.
Loadstring isn’t inherently dangerous. Realistically the risk of using it is pretty tiny. If this is for the owners game then he doesn’t need to worry about who has access to it.
Yeah, I’ll update my original reply.