I had a major hacking problem on my game, so I had to turn on FilteringEnabled, but unfortunately that breaks a few of the scripts that run on my game. Is there an easy way that I can convert these scripts to be compatible with FilteringEnabled, or will I have to re-write them altogether?

Here are the scripts I'm having problems with. They are all located within ServerScriptService

  • A roleplay name GUI that also displays the character name/description alongside the player's username in the scoreboard
DescriptionKey = "description"
NameKey = "name"

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
	
	ac = script.ScreenGui:Clone()
	ac.Parent = player.PlayerGui
	
	
	--Clone BillboardGui, add to character head
	bc = script.BillboardGui:Clone()
	bc.Parent = character.Head
	bc.Enabled = true
	
	--Create leaderstats
	stats = Instance.new("IntValue", player)
	stats.Name = "leaderstats"
	
	--Create value #1, add to leaderstats
	name = Instance.new("StringValue", stats)
	name.Name = "Name"
	name.Value = ""
	
	--Create value #2, add to leaderstats
	description = Instance.new("StringValue", stats)
	description.Name = "Description"
	description.Value = ""
	
	--Wait for player data to load
	player:WaitForDataReady()
	
	--Load keys
	description.Value = player:LoadString(DescriptionKey)
	
	name.Value = player:LoadString(NameKey)
	
	--Display information
	character.Head.BillboardGui.MainFrame.PlayerLabel.Text = name.Value
	
	character.Head.BillboardGui.MainFrame.OccupationLabel.Text = description.Value

	end)
end)

game.Players.PlayerRemoving:connect(function(player)
	--Save string, match corresponding values to keys
	player:SaveString(DescriptionKey, player.leaderstats.Description.Value)
	player:SaveString(NameKey, player.leaderstats.Name.Value)
	
end)

while true do
	for i,v in pairs(game.Players:GetPlayers()) do
		if v.leaderstats.Description.Value ~= "" then
			v:SaveString(DescriptionKey, v.leaderstats.Description.Value)
		end
		if v.leaderstats.Name.Value ~= "" then
		v:SaveString(NameKey, v.leaderstats.Name.Value)
		end
	end
	wait(120) --Save interval
end
  • A cutscene that moves the camera along the map and displays the game title. The cutscene is working fine, but the button to skip it does not show up...

  • PlayerEntered

local cscript = script:WaitForChild("CutsceneScript")
if script:findFirstChild("SkipCutsceneGuiValue") then
	script.SkipCutsceneGuiValue.Parent = cscript
	script.SkipCutsceneGui.Parent = cscript
end

function onPlayerEntered(player)
	repeat wait () until player.Character
	local new_script = script.CutsceneScript:clone()
	new_script.Parent = player.Character
	new_script.Disabled = false
end

game.Players.PlayerAdded:connect(onPlayerEntered)
onPlayerEntered(game.Players:WaitForChild("Player1")) -- Has to be done since it doesn't work offline for some reason.
  • CutsceneScript (stored inside PlayerEntered)
repeat wait () until game.Workspace.CurrentCamera ~= nil

local c = game.Workspace.CurrentCamera
local data = LoadLibrary("RbxUtility").DecodeJSON(script.CutsceneData.Value)
local rs = game:GetService("RunService").RenderStepped

function tweenCam(c1,f1,time,fov,roll)
	local c0,f0,fv0,r0,frames = c.CoordinateFrame,c.Focus,c.FieldOfView,c:GetRoll(),time/0.015
	for i = 1,frames do
		c.CameraType = "Scriptable"
		c.CoordinateFrame = CFrame.new(c0.p:lerp(c1.p,i/frames),f0.p:lerp(f1.p,i/frames))
		c.FieldOfView = (fv0+(fov-fv0)*(i*(1/frames)))
		c:SetRoll(r0+(roll-r0)*(i*(1/frames)))
		rs:wait()
	end
end

print("Running")
c.CameraSubject = nil	
c.CameraType = "Scriptable"
c.CoordinateFrame = CFrame.new(unpack(data[1].c1))
c.Focus = CFrame.new(unpack(data[1].f1))
c.FieldOfView = data[1].FOV
c:SetRoll(data[1].Roll)
if script:findFirstChild("SkipCutsceneGuiValue") then
	local gui = script.SkipCutsceneGui:clone()
	gui.Parent = game.Players.LocalPlayer.PlayerGui
	gui.Cutscene.Value = script
	gui.Main.Debug.Disabled = false
	script.SkipCutsceneGuiValue.Value = gui
end
for i = 2,#data do
	tweenCam(CFrame.new(unpack(data[i].c1)),CFrame.new(unpack(data[i].f1)),data[i].step,data[i].FOV,data[i].Roll)
end
c.CameraSubject = game.Players.LocalPlayer.Character.Humanoid	
c.CameraType = "Custom"
c.FieldOfView = 70
if script:findFirstChild("SkipCutsceneGuiValue") then
	if script.SkipCutsceneGuiValue.Value ~= nil then
		script.SkipCutsceneGuiValue.Value:Destroy()
	end
end
script:Destroy()
  • A script for a weather plugin I got from the library, that allows admins to open a panel in-game to change the weather (The plugin is called TTP Weather Systems)
local Weather = {
	"Auto",
	"Sunny",
	"Partly Cloudy",
	"Mostly Cloudy",
	"Cloudy",
	"Drizzle",
	"Freezing Drizzle",
	"Flurries",
	"Showers",
	"Rain / Snow Showers",
	"Snow Showers",
	"Rain",
	"Rain / Snow",
	"Snow",
	"Heavy Rain",
	"Heavy Rain / Snow",
	"Heavy Snow",
	"Thunderstorms",
	"Strong Thunderstorms"	
}

local GUI = script.Parent.Frame
local SelectedWeather = "Sunny"

local WeatherDropDown, updateWeatherSelection = LoadLibrary("RbxGui").CreateDropDownMenu(Weather, function(value) SelectedWeather = value end)
WeatherDropDown.Name = "WeatherDropDownLower"
WeatherDropDown.Position = UDim2.new(0, 20, 0, 60)
WeatherDropDown.Size = UDim2.new(0, 240, 0, 40)
WeatherDropDown.Parent = GUI
WeatherDropDown.Visible = true

GUI.SetWeather.MouseButton1Click:connect(function()
	game.ReplicatedStorage.WeatherResources.Settings.AdminEvent:FireServer("Weather", SelectedWeather)
end)

GUI.SetTime.MouseButton1Click:connect(function()
	game.ReplicatedStorage.WeatherResources.Settings.AdminEvent:FireServer("Time", GUI.Time.Text)
end)

GUI.Back.MouseButton1Click:connect(function()
	GUI.Visible = false
end)

repeat wait() until game.Players.LocalPlayer ~= nil

game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(Key)
	if Key == game.ReplicatedStorage.WeatherResources.Settings.AdminHotKey.Value then
		GUI.Visible = true
	end
end)
  • A script inside a button that triggers a volcano to erupt
local onoff = 2 
local eruption = game.Workspace.Volcano.erupt
--- onoff = 2 then eruption is on
--- onoff = 1 then eruption is off

function onClicked(playerWhoClicked)
    if onoff == 1 then
        eruption.Value = true 
        onoff = 2	
        else
        eruption.Value = false
        onoff = 1
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

  • The script inside the model that is triggered by the button and clones the "lava" brick several times to simulate lava flowing
while true do
wait(.1)
if script.Parent.Parent.erupt.Value==true then
	m=script.Parent.lava:Clone()
	m.Parent=game.Workspace
	m.Anchored=false
	m.CanCollide=true
	
end
end 
  • The script inside the "lava"
function onTouch(part)
local humanoid = part.Parent:findFirstChild("Humanoid")
if (humanoid ~=nil) then
humanoid.Health = 0
end
end

script.Parent.Touched:connect(onTouch) 
  • And finally the clear script that gets rid of the cloned lava after a specified time
m=script.Parent
while true do
wait(.01)
if m.Anchored==false then
wait(10)
m.Transparency=.3
wait(.5)
m.Transparency=.6
wait(.5)
m.Transparency=.9
wait(.1)
m:Remove()
end
end

Thank you to anyone who can help me with this. I just want to keep my game functioning without worrying about hackers making the rest of the players miserable...