コンテンツへスキップ
動作中

W.I.P untitled drift game lag reduction

CLclarkdevlinorg1 閲覧数Universal2026年7月26日
共有
W.I.P untitled drift game lag reduction

スクリプトコード

Lua
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local LOCAL_PLAYER = Players.LocalPlayer
local LOCAL_CAR_NAME = LOCAL_PLAYER.Name .. "sCar"

local HIDE_DISTANCE = 100
local UPDATE_RATE = 0.25 -- seconds

type CarData = {
	Model: Model,
	Parts: {BasePart},
	Hidden: boolean,
}

local trackedCars: {[Model]: CarData} = {}

local function getRoot(model: Model): BasePart?
	return model.PrimaryPart
		or model:FindFirstChild("HumanoidRootPart", true)
		or model:FindFirstChildWhichIsA("BasePart", true)
end

local function collectRenderableParts(container: Instance, output: {BasePart})
	for _, obj in ipairs(container:GetDescendants()) do
		if obj:IsA("BasePart") then
			table.insert(output, obj)
		end
	end
end

local function scanCar(car: Model)
	if trackedCars[car] then
		return
	end

	if car.Name == LOCAL_CAR_NAME then
		return
	end

	if not car.Name:match("sCar$") then
		return
	end

	local renderParts = {}

	local targetContainers = {
	"Paint",
	"Misc",
	"shirtstuckedin",
	"c55ag9i",
	"jokus13ag9i",
	"3037ag9i",
	"s14icy",
	"jzx81ag9i",
	"jee46",
	"Model",
	"fd3s",
	"c33",
	"joo o",
}

for _, name in ipairs(targetContainers) do
	local container = car:FindFirstChild(name, true)
	if container then
		collectRenderableParts(container, renderParts)
	end
end

	trackedCars[car] = {
		Model = car,
		Parts = renderParts,
		Hidden = false,
	}
end

local function removeCar(car: Model)
	trackedCars[car] = nil
end

local function hideCar(data: CarData)
	if data.Hidden then
		return
	end

	data.Hidden = true

	for _, part in ipairs(data.Parts) do
		if part.Parent then
			part.LocalTransparencyModifier = 1
		end
	end
end

local function showCar(data: CarData)
	if not data.Hidden then
		return
	end

	data.Hidden = false

	for _, part in ipairs(data.Parts) do
		if part.Parent then
			part.LocalTransparencyModifier = 0
		end
	end
end

for _, obj in ipairs(workspace:GetDescendants()) do
	if obj:IsA("Model") then
		scanCar(obj)
	end
end

workspace.DescendantAdded:Connect(function(obj)
	if obj:IsA("Model") then
		scanCar(obj)
	end
end)

workspace.DescendantRemoving:Connect(function(obj)
	if obj:IsA("Model") then
		removeCar(obj)
	end
end)

local accumulator = 0

RunService.Heartbeat:Connect(function(dt)
	accumulator += dt

	if accumulator < UPDATE_RATE then
		return
	end

	accumulator = 0

	local character = LOCAL_PLAYER.Character
	if not character then
		return
	end

	local hrp = character:FindFirstChild("HumanoidRootPart")
	if not hrp then
		return
	end

	local playerPos = hrp.Position

	for model, data in pairs(trackedCars) do
		if not model.Parent then
			trackedCars[model] = nil
			continue
		end

		local root = getRoot(model)
		if not root then
			continue
		end

		local dist = (root.Position - playerPos).Magnitude

		if dist >= HIDE_DISTANCE then
			hideCar(data)
		else
			showCar(data)
		end
	end
end)

説明

Gets other players cars, gets their paint and interior (still working on getting the interior layers) and makes them transparent based on distance. planning on adding more models to be affected, and planning on having it adjust particles and decals for the skid marks and wheel smoke

コメント (0)

会話に参加するにはログインしてください

  • 最初のコメントを投稿しましょう。

よくある質問

W.I.P untitled drift game lag reductionスクリプトはどう使いますか?
上のスクリプトコードをコピーし、Robloxエグゼキューターを開いて貼り付け、ゲーム中に実行を押してください。スクリプトが実行されると、機能が即座に有効になります。
W.I.P untitled drift game lag reductionスクリプトは無料ですか?
はい。このスクリプトは無料でコピー&使用できます。キーシステムを使用している場合は、リンクから無料でキーを取得してください。
W.I.P untitled drift game lag reductionスクリプトの使用は安全ですか?
ソースコード全体がこのページに表示されるので、実行前に内容を正確に確認できます。信頼できるエグゼキューターを使用し、スクリプトの使用はRobloxの利用規約に違反するため、自己責任で使用してください。
W.I.P untitled drift game lag reductionに対応するエグゼキューターは?
このスクリプトはほとんどの人気Robloxエグゼキューターで動作します。お使いのデバイス向けの信頼できる無料または有料エグゼキューターを見つけるには、エグゼキューターページをご覧ください。
W.I.P untitled drift game lag reduction | BloxScripter