hey so i have a commission for roblox and its just bug fixing so lets do it!

basically first bug is the game is a kill players and steal their time and when the dev killed a player with 84,039 time it didnt get transfered to the player that killed them which its supposed to.

basically whenever a player kills another player they steal their time.

the thing is i dont know the script that is causing this so im gonna find it quickly.

okay it can be these scripts im not sure.

StatsManagement: ServerScriptService -> PlayerStatsManaging -> StatsManagement

-- Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local DataStoreService = game:GetService("DataStoreService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Configuration
Players.CharacterAutoLoads = true  -- Let Roblox handle respawns fully
local SAFE_ZONE_PART_NAME = "SafeZone"
local TIME_GAIN_RATE = 1
local DATASTORE_NAME = "PlayerStats_v3"
local MAX_XP_PER_SECOND = 3000
local MAX_TIME = 100000000
local XPBoostPerLevel = 4

-- Data
local playerDataStore = DataStoreService:GetDataStore(DATASTORE_NAME)
local playerStates = {}
local recentKills = {}

-- Remotes
local remoteXP = ReplicatedStorage:WaitForChild("UpdateXPDetails", 5)
local killLogEvent = ReplicatedStorage:FindFirstChild("KillLogEvent")
if not killLogEvent then
	killLogEvent = Instance.new("RemoteEvent", ReplicatedStorage)
	killLogEvent.Name = "KillLogEvent"
end

function _G.awardXP(player, amount, sourceText)
	local playerData = player:FindFirstChild("PlayerData")
	local stats = player:FindFirstChild("leaderstats")
	if not playerData or not stats then return end

	local xp = playerData:FindFirstChild("XP")
	local level = stats:FindFirstChild("Level")
	if not xp or not level then return end

	xp.Value += amount

	local success, err = pcall(function()
		local OrderedStore = DataStoreService:GetOrderedDataStore("GlobalLeaderboard_XP")
		local sortKey = (level.Value * 1_000_000) + xp.Value
		OrderedStore:SetAsync(tostring(player.UserId), sortKey)
	end)
	if not success then
		warn("Failed to update leaderboard XP for", player.Name, err)
	end

	if remoteXP then
		local state = playerStates[player.UserId]
		if state then
			state.xpCounters = state.xpCounters or {}
			sourceText = sourceText or "XP"
			state.xpCounters[sourceText] = (state.xpCounters[sourceText] or 0) + 1
			remoteXP:FireClient(player, sourceText, state.xpCounters[sourceText], amount)
		end
	end

	local requiredXP = 100 * (level.Value ^ 2)
	while xp.Value >= requiredXP do
		xp.Value -= requiredXP
		level.Value += 1
		requiredXP = 100 * (level.Value ^ 2)
	end
end

local function isInSafeZone(character)
	local hrp = character:FindFirstChild("HumanoidRootPart")
	if not hrp then return false end
	for _, zone in ipairs(workspace:GetDescendants()) do
		if zone:IsA("BasePart") and zone.Name == SAFE_ZONE_PART_NAME then
			local rel = zone.CFrame:PointToObjectSpace(hrp.Position)
			local half = zone.Size / 2
			if math.abs(rel.X) <= half.X and math.abs(rel.Y) <= half.Y and math.abs(rel.Z) <= half.Z then
				return true
			end
		end
	end
	return false
end

local function savePlayerStats(player)
	local stats = player:FindFirstChild("leaderstats")
	local pdata = player:FindFirstChild("PlayerData")
	if not stats or not pdata then return end

	local record = {
		Time = stats.Time.Value,
		Kills = stats.Kills.Value,
		Level = stats.Level.Value,
		BestTime = stats.BestTime.Value,
		XP = pdata:FindFirstChild("XP") and pdata.XP.Value or 0,
		Streak = stats.Streak.Value
	}
	local success, err = pcall(function()
		playerDataStore:SetAsync(tostring(player.UserId), record)
	end)
	if not success then
		warn("Failed to save data for", player.Name, err)
	end
end

local function updateBestTime(player)
	local stats = player:FindFirstChild("leaderstats")
	if not stats then return end
	local t = stats:FindFirstChild("Time")
	local bt = stats:FindFirstChild("BestTime")
	if t and bt and t.Value > bt.Value then
		bt.Value = t.Value
	end
end

local function sendKillLogToAll(messageData)
	task.spawn(function()
		local ok, err = pcall(function()
			for _, plr in ipairs(Players:GetPlayers()) do
				killLogEvent:FireClient(plr, messageData)
			end
		end)
		if not ok then
			warn("Kill log send failed:", err)
		end
	end)
end

local function handleDeath(player, humanoid)
	local stats = player:FindFirstChild("leaderstats")
	if not stats then return end
	updateBestTime(player)
	savePlayerStats(player)

	local killer = humanoid:FindFirstChild("creator") and humanoid.creator.Value
	local state = playerStates[player.UserId]
	if state then
		state.canGainTime = false
	end

	if killer and killer:IsA("Player") and killer ~= player then
		local kSafe = isInSafeZone(killer.Character)
		local vSafe = isInSafeZone(player.Character)

		if kSafe or (not kSafe and not vSafe) then
			local id = ("%d_%d_%d"):format(player.UserId, killer.UserId, os.time())
			if not recentKills[id] then
				recentKills[id] = true
				task.delay(10, function() recentKills[id] = nil end)

				local kstats = killer:FindFirstChild("leaderstats")
				if kstats then
					local stolenTime = stats.Time.Value
					kstats.Time.Value += stolenTime
					stats.Time.Value = 0

					kstats.Kills.Value += 1
					kstats.Level.Value = math.floor(kstats.Kills.Value / 10) + 1
					kstats.Streak.Value += 1
					stats.Streak.Value = 0

					updateBestTime(killer)
					savePlayerStats(killer)
					_G.awardXP(killer, 100, "Kill")

					local dist = 0
					local hrpK = killer.Character:FindFirstChild("HumanoidRootPart")
					local hrpV = player.Character:FindFirstChild("HumanoidRootPart")
					if hrpK and hrpV then
						dist = math.floor((hrpK.Position - hrpV.Position).Magnitude * 10) / 10
					end

					sendKillLogToAll({
						KillerName = killer.Name,
						VictimName = player.Name,
						TimeNow = kstats.Time.Value,
						StolenTime = stolenTime,
						Distance = dist,
						ToolName = (killer.Character:FindFirstChildOfClass("Tool") or {}).Name or "Fists",
						Streak = kstats.Streak.Value
					})
				end
			else
				stats.Time.Value = 0
			end
		else
			stats.Time.Value = 0
			if not vSafe then
				sendKillLogToAll({
					KillerName = nil,
					VictimName = player.Name,
					TimeNow = stats.Time.Value,
					StolenTime = 0,
					Distance = 0,
					ToolName = "Died"
				})
			end
		end
	elseif not isInSafeZone(player.Character) then
		local lost = stats.Time.Value
		stats.Time.Value = 0
		sendKillLogToAll({
			KillerName = nil,
			VictimName = player.Name,
			TimeNow = lost,
			StolenTime = 0,
			Distance = 0,
			ToolName = "Died"
		})
	end
end

local function onCharacterAdded(player, character)
	local state = playerStates[player.UserId]
	if not state then return end

	state.canGainTime = true
	state.lastTimeUpdate = os.clock()

	if not isInSafeZone(character) then
		player.leaderstats.Time.Value = 0
	end

	local humanoid = character:WaitForChild("Humanoid", 10)
	if not humanoid then
		warn("No Humanoid for", player.Name)
		return
	end

	humanoid.Died:Connect(function()
		state.canGainTime = false
		pcall(handleDeath, player, humanoid)
		-- No forced respawn, let Roblox handle it
	end)
end

local function setupPlayer(player)
	local stats = Instance.new("Folder", player)
	stats.Name = "leaderstats"
	for name, val in pairs({Time=0, Kills=0, Level=1, BestTime=0, Streak=0}) do
		local st = Instance.new("IntValue", stats)
		st.Name = name
		st.Value = val
	end

	local pdata = Instance.new("Folder", player)
	pdata.Name = "PlayerData"
	local xp = Instance.new("NumberValue", pdata)
	xp.Name = "XP"

	local success, data = pcall(function()
		return playerDataStore:GetAsync(tostring(player.UserId))
	end)
	if success and data then
		local ls = player.leaderstats
		ls.Time.Value = data.Time or 0
		ls.Kills.Value = data.Kills or 0
		ls.Level.Value = data.Level or 1
		ls.BestTime.Value = data.BestTime or 0
		xp.Value = data.XP or 0
		ls.Streak.Value = data.Streak or 0
	end

	playerStates[player.UserId] = {
		canGainTime = false,
		lastTimeUpdate = os.clock(),
		lastXPUpdate = 0,
		xpCounters = {},
		lastSafeState = true,
	}

	player.CharacterAdded:Connect(function(character)
		onCharacterAdded(player, character)
	end)
end

RunService.Heartbeat:Connect(function()
	local now = os.clock()
	for _, player in ipairs(Players:GetPlayers()) do
		local state = playerStates[player.UserId]
		local stats = player:FindFirstChild("leaderstats")
		local char = player.Character
		local humanoid = char and char:FindFirstChild("Humanoid")
		if state and stats and humanoid and humanoid.Health > 0 and char:FindFirstChild("HumanoidRootPart") then
			local inSafe = isInSafeZone(char)
			if inSafe and not state.lastSafeState then
				state.xpCounters = {}
			end
			state.lastSafeState = inSafe

			if not inSafe then
				state.canGainTime = true
				if now - state.lastTimeUpdate >= 1 then
					stats.Time.Value += TIME_GAIN_RATE
					state.lastTimeUpdate = now

					if not state.lastXPUpdate or now - state.lastXPUpdate >= 1 then
						local xpGain = 1
						if stats.Time.Value >= 1000 then
							local level = stats.Level.Value
							xpGain = stats.Time.Value >= MAX_TIME and MAX_XP_PER_SECOND
								or math.clamp(math.ceil(((math.clamp(stats.Time.Value,1000,MAX_TIME)-1000)/(MAX_TIME-1000))^0.25 * level * XPBoostPerLevel), 1, MAX_XP_PER_SECOND)
						end
						_G.awardXP(player, xpGain, "Explorer")
						state.lastXPUpdate = now
					end

					if stats.Time.Value % 60 == 0 then
						savePlayerStats(player)
					end
				end
			else
				state.canGainTime = false
				state.lastTimeUpdate = now
			end
		end
	end
end)

Players.PlayerAdded:Connect(setupPlayer)
Players.PlayerRemoving:Connect(function(player)
	savePlayerStats(player)
	playerStates[player.UserId] = nil
end)

game:BindToClose(function()
	for _, plr in ipairs(Players:GetPlayers()) do
		savePlayerStats(plr)
	end
end)

or this script KillLog: ServerScriptService -> PlayerStatsManaging -> KillLog

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

--RemoteEvent to trigger the client log
local logEvent = Instance.new("RemoteEvent")
logEvent.Name = "KillLogEvent"
logEvent.Parent = ReplicatedStorage

--Function to log kill to client
function logKillToClient(killer, victim, stolenTime, distance, toolName)
	if not killer or not victim then return end
	local killerStats = killer:FindFirstChild("leaderstats")
	if not killerStats then return end

	local currentTime = killerStats:FindFirstChild("Time") and killerStats.Time.Value or 0
	logEvent:FireClient(killer, {
		KillerName = killer.Name,
		VictimName = victim.Name,
		TimeNow = currentTime,
		StolenTime = stolenTime,
		Distance = distance,
		ToolName = toolName or "Unknown"
	})
end