You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Get all of depreciated variables to change all at once…instead of manually opening each and control + v
What is the issue? Include screenshots / videos if possible!
I want to change all of the “Game” to “game” for the scripts
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
You can modify the script’s ‘Source’ property and use string.gsub() to replace Game with game.
local services = {}
for i,v in pairs(game:GetChildren()) do
pcall(function()
services[#services + 1] = game:GetService(v.Name)
end)
end
for i,service in pairs(services) do
pcall(function()
if v:IsA('Script') or v:IsA('LocalScript') or v:IsA('ModuleScript') then
local newScript = string.gsub(v.Source, 'Game', 'game')
v.Source = newScript
end
end)
end
I’m talking about changing all the scripts that are using the variable, “Game” to “game” instead of manually opening each script and changing the variable to game by using the command bar.
local services = {}
for i,v in pairs(game:GetChildren()) do
pcall(function()
services[#services + 1] = game:GetService(v.Name)
end)
end
for i,service in pairs(services) do
for i,v in pairs(service:GetDescendants()) do
pcall(function()
if v:IsA('LuaSourceContainer') then
local newScript = string.gsub(v.Source, 'Game', 'game')
v.Source = newScript
end
end)
end
end
The manual way to do it is open each affected script and press CTRL+H, which brings up the “find and replace” tool. Enter “Game” as your “find” and “game” as your replace, and press replace all.
There may be an option to do this across all scripts, as some code editors do, but I’m not 100% sure on that.
local services = {}
for i,v in pairs(game:GetChildren()) do
pcall(function()
services[#services + 1] = game:GetService(v.Name)
end)
end
for i,service in pairs(services) do
for i,v in pairs(service:GetDescendants()) do
pcall(function()
if v:IsA('LuaSourceContainer') then
local newScript = string.gsub(v.Source, 'while true do
script.Parent.Y.Color=Color3.new()
script.Parent.R.Color=Color3.new(1,0,0)
wait(22.05)
script.Parent.Y.Color=Color3.new()
script.Parent.R.Color=Color3.new()
script.Parent.G.Color=Color3.new(0,1,0)
wait(17.5)
script.Parent.G.Color=Color3.new()
script.Parent.Y.Color=Color3.new(1,1,0)
wait(2.55)
end
', 'while true do
script.Parent.R.SurfaceLight.Enabled = false
script.Parent.Y.Color=Color3.new()
script.Parent.R.Color=Color3.new()
script.Parent.G.SurfaceLight.Enabled = true
script.Parent.G.Color=Color3.new(0,1,0)
wait(17.5)
script.Parent.G.SurfaceLight.Enabled = false
script.Parent.G.Color=Color3.new()
script.Parent.Y.SurfaceLight.Enabled = true
script.Parent.Y.Color=Color3.new(1,1,0)
wait(2.55)
script.Parent.Y.SurfaceLight.Enabled = false
script.Parent.Y.Color=Color3.new()
script.Parent.R.Color=Color3.new(1,0,0)
script.Parent.R.SurfaceLight.Enabled = true
wait(22.05)
end
')
v.Source = newScript
end
end)
end
end