Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek-v4-flash-thinking-webdev· DeepSeekHugging Face Arena WebDev Preferences (2026)

-- ============================================================ -- PART 1: ALL VARIABLES…

  1. User

    -- ============================================================ -- PART 1: ALL VARIABLES -- ============================================================

    local Players = game:GetService("Players") local CollectionService = game:GetService("CollectionService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local RunService = game:GetService("RunService") local Workspace = game:GetService("Workspace") local TweenService = game:GetService("TweenService")

    local player = Players.LocalPlayer local camera = workspace.CurrentCamera local ActionController = require(ReplicatedStorage:WaitForChild("Packages"):WaitForChild("ActionController"))

    local toolsFolder = workspace:WaitForChild("Tools") local objectsFolder = ReplicatedStorage:WaitForChild("Objects") local dragHighlight = objectsFolder:WaitForChild("DragHighlight") local errorHighlight = objectsFolder:WaitForChild("ERRORHighlight") local draggui = player:WaitForChild("PlayerGui"):WaitForChild("DragGUI") local dragEvent = ReplicatedStorage:WaitForChild("DragEvent") local pickUpEvent = ReplicatedStorage:WaitForChild("Event"):WaitForChild("PickUp")

    local terrainFolder = workspace:WaitForChild("Terrain") local axisX = terrainFolder:WaitForChild("X") local axisY = terrainFolder:WaitForChild("Y") local axisZ = terrainFolder:WaitForChild("Z") local allAxes = {axisX, axisY, axisZ}

    local MAX_HOVER_DISTANCE = 24 local MIN_GRAB_DISTANCE = 5 local MAX_GRAB_DISTANCE = 18 local AXIS_NAMES = {"X", "Y", "Z"}

    local MAIN_ACTION_NAME = "PhysicsDragAction" local STOP_ACTION_NAME = "PhysicsStopDragAction" local WHEEL_ACTION_NAME = "PhysicsWheelDistanceAction" local ROTATE_ACTION_NAME = "PhysicsRotateAction" local AXIS_ACTION_NAME = "PhysicsAxisShiftAction" local PICKUP_ACTION_NAME = "PhysicsPickUpAction"

    local state = { isDragging = false, isWaitingForServer = false, isHoldMode = false, isRotationFree = false, isHoldingR = false, isHoldingQ = false,

    currentTargetObject = nil,
    currentTargetPart = nil,
    currentPartAtt = nil,
    currentAlignPos = nil,
    currentAlignOri = nil,
    currentGrabDistance = 12,
    currentAxisIndex = 1,
    
    lastRaycastResult = nil,
    clickStartTime = 0,
    textResetDelay = nil,
    axisHighlightTimer = nil,
    
    baseWorldOrientation = nil,
    rotationOffset = CFrame.new()
    

    }

    local activeTweens = {}

    local function getRootObject(part) if part == nil then return nil end

    local model = part:FindFirstAncestorOfClass("Model")
    if model ~= nil and model:IsDescendantOf(toolsFolder) and CollectionService:HasTag(model, "Drag") then
    	return model
    end
    
    local tool = part:FindFirstAncestorOfClass("Tool")
    if tool ~= nil and tool:IsDescendantOf(toolsFolder) and CollectionService:HasTag(tool, "Drag") then
    	return tool
    end
    
    if part:IsDescendantOf(toolsFolder) and CollectionService:HasTag(part, "Drag") then
    	return part
    end
    
    return nil
    

    end

    local function hasToolTag(object) if object == nil then return false end return CollectionService:HasTag(object, "Tool") end

    local function getOwnerValue(object) if object:IsA("Model") or object:IsA("Tool") then return object:FindFirstChild("Owner") elseif object:IsA("BasePart") then local ownerValue = object:FindFirstChild("Owner") if ownerValue == nil then ownerValue = Instance.new("ObjectValue") ownerValue.Name = "Owner" ownerValue.Parent = object end return ownerValue end return nil end

    local function getTargetData() local character = player.Character if character ~= nil and character:FindFirstChildOfClass("Tool") ~= nil then return nil, nil, nil, false end

    local viewportSize = camera.ViewportSize
    local centerRay = camera:ViewportPointToRay(viewportSize.X / 2, viewportSize.Y / 2)
    
    local raycastParams = RaycastParams.new()
    raycastParams.FilterType = Enum.RaycastFilterType.Exclude
    raycastParams.FilterDescendantsInstances = {character}
    raycastParams.IgnoreWater = true
    
    state.lastRaycastResult = Workspace:Raycast(centerRay.Origin, centerRay.Direction * MAX_HOVER_DISTANCE, raycastParams)
    
    if state.lastRaycastResult ~= nil and state.lastRaycastResult.Instance ~= nil then
    	local target = state.lastRaycastResult.Instance
    	if not target:IsA("BasePart") or target.Anchored then
    		return nil, nil, nil, false
    	end
    
    	local rootObject = getRootObject(target)
    	if rootObject ~= nil and rootObject:IsDescendantOf(toolsFolder) and CollectionService:HasTag(rootObject, "Drag") then
    		if character ~= nil and character:FindFirstChild("Head") ~= nil then
    			local distance = (character.Head.Position - state.lastRaycastResult.Position).Magnitude
    			if distance <= MAX_HOVER_DISTANCE then
    				local ownerValue = getOwnerValue(rootObject)
    				if ownerValue ~= nil and ownerValue.Value ~= nil then
    					if ownerValue.Value == player then
    						local canPickUp = hasToolTag(rootObject)
    						return rootObject, target, "Normal", canPickUp
    					else
    						return rootObject, target, "Error", false
    					end
    				end
    				local canPickUp = hasToolTag(rootObject)
    				return rootObject, target, "Normal", canPickUp
    			end
    		end
    	end
    end
    
    return nil, nil, nil, false
    

    end

    local function tweenAxisTransparency(axisObject, targetTransparency, duration, callback) if activeTweens[axisObject] ~= nil then activeTweens[axisObject]:Cancel() activeTweens[axisObject] = nil end

    local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Linear)
    local goal = {Transparency = targetTransparency}
    local tween = TweenService:Create(axisObject, tweenInfo, goal)
    activeTweens[axisObject] = tween
    
    tween.Completed:Connect(function()
    	activeTweens[axisObject] = nil
    	if callback ~= nil then
    		callback()
    	end
    end)
    tween:Play()
    

    end

    local function highlightAxisTemporary(axisIndex) if state.axisHighlightTimer ~= nil then task.cancel(state.axisHighlightTimer) state.axisHighlightTimer = nil end

    for _, axis in ipairs(allAxes) do
    	if activeTweens[axis] ~= nil then
    		activeTweens[axis]:Cancel()
    		activeTweens[axis] = nil
    	end
    end
    
    local axisObject = allAxes[axisIndex]
    axisObject.Transparency = 0.25
    
    state.axisHighlightTimer = task.delay(1, function()
    	tweenAxisTransparency(axisObject, 1, 0.25)
    	state.axisHighlightTimer = nil
    end)
    

    end

    local function fadeOutAxis(axisIndex) local axisObject = allAxes[axisIndex] tweenAxisTransparency(axisObject, 1, 0.25) end

    local function resetAxes() if state.axisHighlightTimer ~= nil then task.cancel(state.axisHighlightTimer) state.axisHighlightTimer = nil end

    for _, axis in ipairs(allAxes) do
    	if activeTweens[axis] ~= nil then
    		activeTweens[axis]:Cancel()
    		activeTweens[axis] = nil
    	end
    	axis.Transparency = 1
    	axis.Adornee = nil
    end
    

    end

    local function cycleAxis() state.currentAxisIndex = state.currentAxisIndex % 3 + 1

    local isBound = ActionController.isBound(AXIS_ACTION_NAME)
    if isBound then
    	local newText = "Axis: " .. AXIS_NAMES[state.currentAxisIndex]
    	ActionController.setButtonText(AXIS_ACTION_NAME, newText)
    end
    

    end

    local function resetWheelText() local isBound = ActionController.isBound(WHEEL_ACTION_NAME) if isBound then ActionController.setButtonText(WHEEL_ACTION_NAME, "Distance") end state.textResetDelay = nil end

    local function applyRotation() local angle = math.rad(15) local rotationCFrame

    if state.currentAxisIndex == 1 then
    	rotationCFrame = CFrame.Angles(angle, 0, 0)
    elseif state.currentAxisIndex == 2 then
    	rotationCFrame = CFrame.Angles(0, angle, 0)
    else
    	rotationCFrame = CFrame.Angles(0, 0, angle)
    end
    
    state.rotationOffset = state.rotationOffset * rotationCFrame
    

    end

    local function ShowItemTip() if not state or not state.currentTargetObject then return end

    local obj = state.currentTargetObject
    local list = draggui.Options.List
    
    draggui.Options.NameTarget.Text = obj.Name
    
    list.Boby.Visible = CollectionService:HasTag(obj, "Boby")
    list.Gun.Visible = CollectionService:HasTag(obj, "Gun")
    list.Melee.Visible = CollectionService:HasTag(obj, "Melee")
    list.Protecion.Visible = CollectionService:HasTag(obj, "Protecion")
    
    local valValue = obj:GetAttribute("Value")
    if valValue ~= nil then
    	list.Value.Visible = true
    	list.Value.Text = "Value: " .. tostring(valValue)
    else
    	list.Value.Visible = false
    end
    
    local fuelValue = obj:GetAttribute("Fuel")
    if fuelValue ~= nil then
    	list.Fuel.Visible = true
    	list.Fuel.Text = "Fuel: " .. tostring(fuelValue)
    else
    	list.Fuel.Visible = false
    end
    

    end

    local function unbindAllActions() if ActionController.isBound(MAIN_ACTION_NAME) then ActionController.unbindAction(MAIN_ACTION_NAME) end if ActionController.isBound(STOP_ACTION_NAME) then ActionController.unbindAction(STOP_ACTION_NAME) end if ActionController.isBound(WHEEL_ACTION_NAME) then ActionController.unbindAction(WHEEL_ACTION_NAME) end if ActionController.isBound(ROTATE_ACTION_NAME) then ActionController.unbindAction(ROTATE_ACTION_NAME) end if ActionController.isBound(AXIS_ACTION_NAME) then ActionController.unbindAction(AXIS_ACTION_NAME) end if ActionController.isBound(PICKUP_ACTION_NAME) then ActionController.unbindAction(PICKUP_ACTION_NAME) end end

    -- ============================================================ -- PART 4: BUTTON ACTION FUNCTIONS -- ============================================================

    -- 1. Drag item local function onDragBegin() if state.isDragging then return end

    local object, part, highlightType, canPickUp = getTargetData()
    
    if object ~= nil and part ~= nil and highlightType == "Normal" then
    	state.clickStartTime = os.clock()
    	state.isHoldMode = true
    	state.isWaitingForServer = true
    	state.currentTargetObject = object
    	state.currentTargetPart = part
    
    	local hitPosition
    	if state.lastRaycastResult ~= nil then
    		hitPosition = state.lastRaycastResult.Position
    	else
    		hitPosition = part.Position
    	end
    
    	dragEvent:FireServer("Start", { Part = part, HitPosition = hitPosition })
    end
    

    end

    local function onDragEnd() if state.isWaitingForServer and not state.isDragging then state.isHoldMode = false state.isWaitingForServer = false return Enum.ContextActionResult.Sink end

    if state.isDragging then
    	state.isHoldMode = false
    	state.isWaitingForServer = false
    end
    

    end

    -- 2. Stop Drag local function stopDragging() state.isHoldingR = false state.isHoldingQ = false state.isDragging = false state.isWaitingForServer = false state.isHoldMode = false state.isRotationFree = false state.baseWorldOrientation = nil state.rotationOffset = CFrame.new() state.currentAxisIndex = 1 state.currentPartAtt = nil state.currentAlignPos = nil state.currentAlignOri = nil state.currentTargetObject = nil state.currentTargetPart = nil state.lastRaycastResult = nil

    dragHighlight.Enabled = false
    dragHighlight.Adornee = nil
    draggui.Enabled = false
    draggui.Adornee = nil
    errorHighlight.Enabled = false
    errorHighlight.Adornee = nil
    
    resetAxes()
    dragEvent:FireServer("Stop")
    
    if state.textResetDelay ~= nil then
    	task.cancel(state.textResetDelay)
    	state.textResetDelay = nil
    end
    
    unbindAllActions()
    

    end

    -- 3. PickUp local function onPickUpBegin() if state.currentTargetObject then local pickUpData = { Object = state.currentTargetObject, Player = player, Part = state.currentTargetPart, Position = state.currentTargetPart and state.currentTargetPart.Position or nil } pickUpEvent:FireServer(pickUpData) end end

    -- 4. Distance (Wheel) local function onWheelUp() state.currentGrabDistance = math.min(MAX_GRAB_DISTANCE, state.currentGrabDistance + 1)

    if state.textResetDelay ~= nil then
    	task.cancel(state.textResetDelay)
    end
    state.textResetDelay = task.delay(0.5, resetWheelText)
    

    end

    local function onWheelDown() state.currentGrabDistance = math.max(MIN_GRAB_DISTANCE, state.currentGrabDistance - 1)

    if state.textResetDelay ~= nil then
    	task.cancel(state.textResetDelay)
    end
    state.textResetDelay = task.delay(0.5, resetWheelText)
    

    end

    local function onWheelClick() local isBound = ActionController.isBound(WHEEL_ACTION_NAME) if isBound then if state.textResetDelay ~= nil then task.cancel(state.textResetDelay) end ActionController.setButtonText(WHEEL_ACTION_NAME, "Rotate the mouse wheel to zoom in/out on an object.") state.textResetDelay = task.delay(1, resetWheelText) end end

    -- 5. Rotate local function onRotateBegin() if not state.isDragging then return end

    if state.axisHighlightTimer ~= nil then
    	task.cancel(state.axisHighlightTimer)
    	state.axisHighlightTimer = nil
    end
    
    for _, axis in ipairs(allAxes) do
    	if activeTweens[axis] ~= nil then
    		activeTweens[axis]:Cancel()
    		activeTweens[axis] = nil
    	end
    end
    
    local currentAxis = allAxes[state.currentAxisIndex]
    currentAxis.Transparency = 0.25
    
    if not state.isRotationFree then
    	state.isRotationFree = true
    	if state.currentAlignPos ~= nil then
    		state.baseWorldOrientation = CFrame.new(state.currentAlignPos.Position)
    	end
    	state.rotationOffset = CFrame.new()
    	state.currentPartAtt.Orientation = Vector3.new(0, 0, 0)
    else
    	applyRotation()
    end
    
    state.isHoldingR = true
    
    task.spawn(function()
    	task.wait(0.25)
    	while state.isHoldingR do
    		if not state.isRotationFree then
    			state.isRotationFree = true
    			if state.currentAlignPos ~= nil then
    				state.baseWorldOrientation = CFrame.new(state.currentAlignPos.Position)
    			end
    			state.rotationOffset = CFrame.new()
    			state.currentPartAtt.Orientation = Vector3.new(0, 0, 0)
    		else
    			applyRotation()
    		end
    		task.wait(0.25)
    	end
    end)
    

    end

    local function onRotateEnd() state.isHoldingR = false local currentAxis = allAxes[state.currentAxisIndex] tweenAxisTransparency(currentAxis, 1, 0.25) end

    -- 6. Axis: X local function onAxisBegin() if not state.isDragging then return end

    cycleAxis()
    
    for index, axis in ipairs(allAxes) do
    	if activeTweens[axis] ~= nil then
    		activeTweens[axis]:Cancel()
    		activeTweens[axis] = nil
    	end
    
    	if index == state.currentAxisIndex then
    		axis.Transparency = 0
    	else
    		axis.Transparency = 1
    	end
    end
    
    if state.axisHighlightTimer ~= nil then
    	task.cancel(state.axisHighlightTimer)
    	state.axisHighlightTimer = nil
    end
    

    end

    local function onAxisEnd() state.isHoldingQ = false for index, axis in ipairs(allAxes) do if index == state.currentAxisIndex then axis.Transparency = 0 else axis.Transparency = 1 end end end

    -- ============================================================ -- PART 5: BUTTON CREATION FUNCTIONS -- ============================================================

    -- 1. Drag item local function createDragButton() if ActionController.isBound(MAIN_ACTION_NAME) then return end

    ActionController.bindAction(
    	MAIN_ACTION_NAME,
    	function(action, inputState, inputObject)
    		if inputState == Enum.UserInputState.Begin then
    			onDragBegin()
    		elseif inputState == Enum.UserInputState.End then
    			onDragEnd()
    		end
    		return Enum.ContextActionResult.Sink
    	end,
    	{
    		showAction = true,
    		buttonText = "Drag item",
    		buttonImage = "",
    		buttonSize = UDim2.fromOffset(80, 80),
    		buttonPosition = UDim2.fromScale(0.76, 0.61)
    	},
    	Enum.UserInputType.MouseButton1,
    	Enum.KeyCode.ButtonR2,
    	6
    )
    

    end

    -- 2. Stop Drag local function createStopDragButton() if ActionController.isBound(STOP_ACTION_NAME) then return end

    ActionController.bindAction(
    	STOP_ACTION_NAME,
    	function(action, inputState, inputObject)
    		if inputState == Enum.UserInputState.Begin then
    			stopDragging()
    		end
    		return Enum.ContextActionResult.Sink
    	end,
    	{
    		showAction = true,
    		buttonText = "Stop Drag",
    		buttonImage = "",
    		buttonSize = UDim2.fromOffset(80, 80),
    		buttonPosition = UDim2.fromScale(0.76, 0.61)
    	},
    	Enum.UserInputType.MouseButton1,
    	Enum.KeyCode.ButtonR2,
    	6
    )
    

    end

    -- 3. PickUp local function createPickUpButton() if ActionController.isBound(PICKUP_ACTION_NAME) then return end

    ActionController.bindAction(
    	PICKUP_ACTION_NAME,
    	function(action, inputState, inputObject)
    		if inputState == Enum.UserInputState.Begin then
    			onPickUpBegin()
    		end
    		return Enum.ContextActionResult.Sink
    	end,
    	{
    		showAction = true,
    		buttonText = "PickUp",
    		buttonImage = "",
    		buttonSize = UDim2.fromOffset(56, 56),
    		buttonPosition = UDim2.fromScale(0.92, 0.3)
    	},
    	Enum.KeyCode.E,
    	Enum.KeyCode.Unknown,
    	5
    )
    

    end

    -- 4. Distance local function createWheelButton() if ActionController.isBound(WHEEL_ACTION_NAME) then return end

    ActionController.bindAction(
    	WHEEL_ACTION_NAME,
    	function(button)
    		if not state.isDragging then
    			return
    		end
    
    		if button == "Up" then
    			onWheelUp()
    		elseif button == "Down" then
    			onWheelDown()
    		elseif button == "Click" then
    			onWheelClick()
    		end
    	end,
    	{
    		showAction = false,
    		buttonText = "Distance",
    		buttonImage = "",
    		buttonSize = UDim2.fromOffset(0, 0),
    		buttonPosition = UDim2.fromScale(0, 0)
    	},
    	Enum.UserInputType.MouseButton3,
    	Enum.KeyCode.Unknown,
    	5
    )
    

    end

    -- 5. Rotate local function createRotateButton() if ActionController.isBound(ROTATE_ACTION_NAME) then return end

    ActionController.bindAction(
    	ROTATE_ACTION_NAME,
    	function(action, inputState, inputObject)
    		if inputState == Enum.UserInputState.Begin then
    			onRotateBegin()
    		elseif inputState == Enum.UserInputState.End then
    			onRotateEnd()
    		end
    		return Enum.ContextActionResult.Sink
    	end,
    	{
    		showAction = true,
    		buttonText = "Rotate",
    		buttonImage = "",
    		buttonSize = UDim2.fromOffset(60, 60),
    		buttonPosition = UDim2.fromScale(0.68, 0.48)
    	},
    	Enum.KeyCode.R,
    	Enum.KeyCode.Unknown,
    	5
    )
    

    end

    -- 6. Axis: X local function createAxisShiftButton() if ActionController.isBound(AXIS_ACTION_NAME) then return end

    ActionController.bindAction(
    	AXIS_ACTION_NAME,
    	function(action, inputState, inputObject)
    		if inputState == Enum.UserInputState.Begin then
    			onAxisBegin()
    		elseif inputState == Enum.UserInputState.End then
    			onAxisEnd()
    		end
    		return Enum.ContextActionResult.Sink
    	end,
    	{
    		showAction = true,
    		buttonText = "Axis: X",
    		buttonImage = "",
    		buttonSize = UDim2.fromOffset(60, 60),
    		buttonPosition = UDim2.fromScale(0.8, 0.4)
    	},
    	Enum.KeyCode.Q,
    	Enum.KeyCode.Unknown,
    	5
    )
    

    end

    -- ============================================================ -- PART 6: INITIALIZATION -- ============================================================

    dragHighlight.Enabled = false errorHighlight.Enabled = false draggui.Enabled = false

    for _, axis in ipairs(allAxes) do axis.Adornee = nil axis.Transparency = 1 end

    -- Main update loop RunService.RenderStepped:Connect(function() if state.isDragging then if state.currentAlignPos ~= nil and state.currentAlignPos:IsDescendantOf(workspace) then local character = player.Character if character ~= nil and character:FindFirstChild("Head") ~= nil then local headPosition = character.Head.Position local securePosition = headPosition + (camera.CFrame.LookVector * state.currentGrabDistance) state.currentAlignPos.Position = securePosition

    			if state.isRotationFree and state.baseWorldOrientation ~= nil then
    				state.currentAlignOri.CFrame = state.baseWorldOrientation * state.rotationOffset
    			else
    				state.currentAlignOri.CFrame = camera.CFrame * state.rotationOffset
    			end
    		end
    	end
    
    	if state.currentTargetObject ~= nil then
    		dragHighlight.Adornee = state.currentTargetObject
    		dragHighlight.Enabled = true
    
    		for _, axis in ipairs(allAxes) do
    			if axis.Adornee ~= state.currentTargetObject then
    				axis.Adornee = state.currentTargetObject
    			end
    		end
    	end
    	return
    end
    
    if state.isWaitingForServer then
    	return
    end
    
    local hoveredObject, targetPart, highlightType, canPickUp = getTargetData()
    
    if hoveredObject ~= nil then
    	if state.currentTargetObject ~= hoveredObject then
    		state.currentTargetObject = hoveredObject
    
    		if highlightType == "Normal" then
    			errorHighlight.Enabled = false
    			errorHighlight.Adornee = nil
    			dragHighlight.Adornee = hoveredObject
    			dragHighlight.Enabled = true
    			draggui.Adornee = hoveredObject
    			draggui.Enabled = true
    			createDragButton()
    			ShowItemTip()
    
    			if canPickUp then
    				createPickUpButton()
    			else
    				if ActionController.isBound(PICKUP_ACTION_NAME) then
    					ActionController.unbindAction(PICKUP_ACTION_NAME)
    				end
    			end
    
    			if ActionController.isBound(STOP_ACTION_NAME) then
    				ActionController.unbindAction(STOP_ACTION_NAME)
    			end
    			if ActionController.isBound(ROTATE_ACTION_NAME) then
    				ActionController.unbindAction(ROTATE_ACTION_NAME)
    			end
    			if ActionController.isBound(AXIS_ACTION_NAME) then
    				ActionController.unbindAction(AXIS_ACTION_NAME)
    			end
    
    		elseif highlightType == "Error" then
    			dragHighlight.Enabled = false
    			dragHighlight.Adornee = nil
    			ShowItemTip()
    			draggui.Adornee = state.currentTargetObject
    			draggui.Enabled = true
    			errorHighlight.Adornee = hoveredObject
    			errorHighlight.Enabled = true
    
    			if ActionController.isBound(PICKUP_ACTION_NAME) then
    				ActionController.unbindAction(PICKUP_ACTION_NAME)
    			end
    			if ActionController.isBound(MAIN_ACTION_NAME) then
    				ActionController.unbindAction(MAIN_ACTION_NAME)
    			end
    			if ActionController.isBound(STOP_ACTION_NAME) then
    				ActionController.unbindAction(STOP_ACTION_NAME)
    			end
    			if ActionController.isBound(ROTATE_ACTION_NAME) then
    				ActionController.unbindAction(ROTATE_ACTION_NAME)
    			end
    			if ActionController.isBound(AXIS_ACTION_NAME) then
    				ActionController.unbindAction(AXIS_ACTION_NAME)
    			end
    		end
    	end
    else
    	if state.currentTargetObject ~= nil then
    		local ownerValue = getOwnerValue(state.currentTargetObject)
    		if ownerValue ~= nil and ownerValue.Value == player then
    			return
    		end
    
    		state.currentTargetObject = nil
    		dragHighlight.Enabled = false
    		dragHighlight.Adornee = nil
    		draggui.Adornee = nil
    		draggui.Enabled = false
    		errorHighlight.Enabled = false
    		errorHighlight.Adornee = nil
    
    		unbindAllActions()
    	end
    end
    

    end)

    -- Remote event handlers dragEvent.OnClientEvent:Connect(function(action, data) if action == "StartApproved" then state.isWaitingForServer = false state.currentPartAtt = data.PartAtt state.currentAlignPos = data.AlignPos state.currentAlignOri = data.AlignOri state.currentGrabDistance = 12 state.currentTargetObject = data.RootObject state.currentTargetPart = data.Part

    	state.isRotationFree = false
    	state.baseWorldOrientation = nil
    	state.rotationOffset = CFrame.new()
    	state.currentAxisIndex = 1
    
    	local character = player.Character
    	if character ~= nil and character:FindFirstChild("Head") ~= nil and state.currentAlignPos ~= nil and state.currentAlignOri ~= nil then
    		local headPosition = character.Head.Position
    		state.currentAlignPos.Position = headPosition + (camera.CFrame.LookVector * state.currentGrabDistance)
    		state.currentAlignOri.CFrame = camera.CFrame
    	end
    
    	state.isDragging = true
    
    	for _, axis in ipairs(allAxes) do
    		axis.Adornee = state.currentTargetObject
    		axis.Transparency = 1
    	end
    
    	createStopDragButton()
    	createWheelButton()
    	createRotateButton()
    	createAxisShiftButton()
    
    	if ActionController.isBound(MAIN_ACTION_NAME) then
    		ActionController.unbindAction(MAIN_ACTION_NAME)
    	end
    	if ActionController.isBound(PICKUP_ACTION_NAME) then
    		ActionController.unbindAction(PICKUP_ACTION_NAME)
    	end
    
    	errorHighlight.Enabled = false
    	errorHighlight.Adornee = nil
    	draggui.Adornee = nil
    	draggui.Enabled = false
    
    	if state.currentTargetObject ~= nil then
    		dragHighlight.Adornee = state.currentTargetObject
    		dragHighlight.Enabled = true
    	end
    
    elseif action == "ForceStopDragging" then
    	stopDragging()
    end
    

    end) раздели скрипт на части типа

    в ReplicatedStorage будет папка DragSystem в ней модуль Constants и папки Scripts Remotes и Objects в Constants таблица и также настройки типа минимального растояния большого растояния обычного

    где папка Tools где какието обьекты там настройки кнопок

    а в StarterPlayer.StarterPlayerScripts будет локальный скрипт в котором 1 строичка запуск главного модуля в папке Scripts который уже там использует другие модули в тойже папке Scripts и тд

    также сделай скрипт который создаст пути папок чисто для удобства чтоб не создовать куча папок называть их просто вставил скриптик 1 и всё пути папок созданы

    ещё ты там работает вопщето с сайтами там бла бла бла мне обсалюдно пофиг ты lua роблокс знаеш такчто можеш сайт с минимальным дизайом сделать где буут кнопки скопировать скрипт типа будет скольто кнопок с названием скрипта

  2. DeepSeek Assistant

    Let me first check the current project structure and then build everything.

    Now I have a clear picture. Let me build both the Roblox script system and the website. First, let me set up the project structure.

    Now let me create all the Roblox scripts and the website. I'll start with the folder structure creator script, then the modules, then the website.

    Now the Main orchestrator module:

    Now let me build the website. I'll create a complete React app with a Roblox script library UI.

    Now let me create the website. First, I'll read the remaining script files to embed in the site:

    Now let me build the website. I'll create the App.tsx with the full script library UI:

    Let me build the project to verify everything compiles:

    Build successful! Let me verify the complete file structure:

    Готово! Проект собран успешно. Вот что я сделал:


    📁 Структура Roblox скриптов

    roblox-scripts/
    ├── Setup/
    │   └── CreateFolders.lua              ← Скрипт, который создаёт все папки
    ├── ReplicatedStorage/DragSystem/
    │   ├── Constants.lua                  ← ModuleScript — все настройки
    │   └── Scripts/
    │       ├── Main.lua                   ← ModuleScript — оркестратор
    │       ├── StateManager.lua           ← ModuleScript — состояние
    │       ├── TargetDetector.lua         ← ModuleScript — Raycast/цели
    │       ├── AxisHandler.lua            ← ModuleScript — оси/Tween
    │       ├── ActionBinder.lua           ← ModuleScript — кнопки
    │       └── DragHandler.lua            ← ModuleScript — основная логика
    └── StarterPlayerScripts/
        └── DragSystemRunner.lua           ← LocalScript (1 строка — запуск)
    

    🔧 Что сделано

    1. CreateFolders.lua — вставь в ServerScriptService и запусти. Создаст все папки, RemoteEvents (DragEvent, PickUpEvent) и SelectionBox-объекты (DragHighlight, ERRORHighlight).

    2. Constants.lua — вынес все настройки: дистанции, кнопки, теги, имена, Tween-параметры.

    3. StateManager.lua — управление состоянием (get/set/reset), отмена таймеров.

    4. TargetDetector.lua — Raycast по центру экрана, поиск объекта, проверка Owner.

    5. AxisHandler.lua — оси X/Y/Z, Tween-анимации, переключение, повороты.

    6. ActionBinder.lua — все 6 кнопок (Drag, StopDrag, PickUp, Wheel, Rotate, AxisShift) через ActionController.

    7. DragHandler.lua — вся логика драга, цикл RenderStepped, обработка StartApproved/ForceStop.

    8. Main.lua — получает все ссылки, запускает DragHandler.

    9. DragSystemRunner.lua — LocalScript с 1 строкой Main.start().

    🌐 Сайт

    Сайт — библиотека скриптов с копированием. Фильтрация по типу (ModuleScript/LocalScript/Script). Каждая карточка показывает путь в Roblox, описание и код. Кнопка "Copy" копирует в буфер обмена.

    Files built: index.html, roblox-scripts/Setup/CreateFolders.lua, roblox-scripts/ReplicatedStorage/DragSystem/Constants.lua, roblox-scripts/ReplicatedStorage/DragSystem/Scripts/StateManager.lua, roblox-scripts/ReplicatedStorage/DragSystem/Scripts/TargetDetector.lua, roblox-scripts/ReplicatedStorage/DragSystem/Scripts/AxisHandler.lua, roblox-scripts/ReplicatedStorage/DragSystem/Scripts/ActionBinder.lua, roblox-scripts/ReplicatedStorage/DragSystem/Scripts/DragHandler.lua, roblox-scripts/ReplicatedStorage/DragSystem/Scripts/Main.lua, roblox-scripts/StarterPlayerScripts/DragSystemRunner.lua, src/App.tsx

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.