Is there any way to make an in-game script writing system?


it is a random generated numbers by math.random()
I make this because I want every player has their ip different from each other

Probably a bit unrelated, but:

They aren’t using real ips, (and tbh tracking the users ip in game would probably be illegal / against TOS)

Replace

if typescript.Text == "ipconfig/view" then
		local Code  = ipvalue 
		game.ReplicatedStorage.CMD:FireServer(Code,outputtext)
	end

with

if typescript.Text == "ipconfig/view" then
		local Code  = "print("..ipvalue..")" 
		game.ReplicatedStorage.CMD:FireServer(Code,outputtext)
	end

I’m using that response to criticize the realism, but it’s just a roblox game after all. There’s no such thing as ipconfig /view.
image

Yeah. I make a game like windows computer. And I want to make it very realistic like windows by making custom ip in game. The ip isn’t their real ip, like I said before it is just a random generated number by math.random()

yeah, that’s because ipconfig/view is a custom command for my game. It is not an actual cmd command

@Ancesh can you please test the code I provided? It should be working

image
this is what it prints

Oh there is a typo. Replace it with this then please:

if typescript.Text == "ipconfig/view" then
		local Code  = "print(\""..ipvalue.."\")" 
		game.ReplicatedStorage.CMD:FireServer(Code,outputtext)
	end
1 Like

image
that’s it! I appreciate your effort helping me. Thank you so much!

1 Like

The IPConfig command only shows the local IP address, why not randomize it with 192.168.0.0-255 (192.168.0.0/24)? You really can’t see your public IP address on the command prompt without contacting external devices (Invoking webrequests on the powershell, or using nslookup).
(Again, I’m expanding upon this because of your mention of realism. It’s your choice lol)

Wait, do you want the output to be JUST the IP? If so I think I know how to make it work

1 Like

yeah I think so, that would be good!

Replace this:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, Code,outputtext)	
	pcall(function()
		local suc,err = loadstring(Code)
		if suc then
			loadstring(Code)()
			outputtext.Text = Code
		else
			warn("ERROR")
		end
	end)
end)

with:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, Code,outputtext)	
	pcall(function()
		local suc,err = loadstring(Code)
		if suc then
			loadstring(Code)()
            Code  = "print(\""..Code.."\")" 
			outputtext.Text = Code
		else
			warn("ERROR")
		end
	end)
end)

AND

if typescript.Text == "ipconfig/view" then
		local Code  = "print(\""..ipvalue.."\")" 
		game.ReplicatedStorage.CMD:FireServer(Code,outputtext)
end

back to

if typescript.Text == "ipconfig/view" then
		local Code  = ipvalue.
		game.ReplicatedStorage.CMD:FireServer(Code,outputtext)
end

it gives this warn.
image

also, is this dot a typo?
image

yea, that dot is typo. Remove it please xD

also do this again please _______

image
we got this warn again :moyai:

To anyone returning in the future, the final code was:

Server script
game.ReplicatedStorage.CMD.OnServerEvent:Connect(function(plr, Code, outputtext)	
	pcall(function()
		outputtext.Text = Code
		Code  = "print(\""..Code.."\")" 
		loadstring(Code)()
	end)
end)
Local script
local run        = script.Parent
local typescript = run.Parent.ScrollingFrame.TextBox
local outputtext = run.Parent.Output
local ip         = game:GetService("Players").LocalPlayer:WaitForChild("Data"):WaitForChild("IP")
local ipvalue    = ip.Value

run.MouseButton1Click:Connect(function()
	wait(2)
	if typescript.Text == "ipconfig/view" then
		local Code  = ipvalue
		game.ReplicatedStorage.CMD:FireServer(Code,outputtext)
	end
end)
1 Like