#How to fix the bouncing

1 messages · Page 1 of 1 (latest)

buoyant drum
twin nebula
buoyant drum
#

Drag_Controller:

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

local Drag_Controller = {}
local dragData = {}
local player = Players.LocalPlayer
local remote = ReplicatedStorage.Remotes.DragNetworkControl

local currentHighlight = nil
local currentTarget = nil

local highlightOBJ = ReplicatedStorage.Game_Objects.HoverHighlight
local draggableFolder

function Drag_Controller.Setup(folder: Instance)
    draggableFolder = folder
    for _, part in folder:GetChildren() do
        if part:IsA("BasePart") then
            local detector = part:FindFirstChildOfClass("DragDetector") or Instance.new("DragDetector")
            detector.Parent = part

            detector.DragStart:Connect(function()
                dragData[part] = true
                remote:FireServer(part, true) -- Request ownership once
            end)

            detector.DragEnd:Connect(function()
                dragData[part] = false
                remote:FireServer(part, false) -- Release ownership
            end)
        end
    end
end

RunService.RenderStepped:Connect(function()
    local character = player.Character
    local hrp = character and character:FindFirstChild("HumanoidRootPart")
    local mouse = player:GetMouse()
    local target = mouse.Target

    -- Hover highlight
    if target and target:IsA("BasePart") and target:IsDescendantOf(draggableFolder) and not dragData[target] then
        if target ~= currentTarget then
            if currentHighlight then
                currentHighlight:Destroy()
            end
            currentTarget = target
            currentHighlight = highlightOBJ:Clone()
            currentHighlight.Adornee = target
            currentHighlight.Parent = target
        end
    else
        if currentHighlight then
            currentHighlight:Destroy()
            currentHighlight = nil
        end
        currentTarget = nil
    end

    -- Move dragged parts
    for part, dragging in pairs(dragData) do
        if dragging and part:IsDescendantOf(workspace) and hrp then
            local forwardPos = hrp.Position + hrp.CFrame.LookVector * 6
            part.Position = part.Position:Lerp(forwardPos, 0.2)
        end
    end
end)

return Drag_Controller
#

server:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage.Remotes.DragNetworkControl

event.OnServerEvent:Connect(function(player, part: BasePart, shouldOwn: boolean)
    if part:IsDescendantOf(workspace) and part:IsA("BasePart") then
        if shouldOwn then
            part:SetNetworkOwner(player)
            print("Set network ownership to: " .. player.Name)
        end
    end
end)
twin nebula
#

okay leme debu

#

debug

#

hmm i never worked with drag detectors

#

so this might take a while

buoyant drum
#

aight ok

twin nebula
#

@buoyant drum what are your dragdetector properties

#

send photo

buoyant drum
#

there isnt any...

#

i just used a script to make 1 cause im lazy

twin nebula
#

oh shoot

#

sorry

#

i didnt see the instance

buoyant drum
#

but this it what it looks like when i test

#

i think i need to use vieworplane not sure

twin nebula
#

k

buoyant drum
#

lemme check

twin nebula
#

@buoyant drum turn it to scriptable

#

dragstyle

buoyant drum
#

ok

#

wait i think i js broke it

#

k i fixed it

buoyant drum
twin nebula
#

bruh idk tbh

#

its prob with something right here

buoyant drum
#

it might be

#

im not sure tho

#

what if i didnt use cframes

#

i found a fix,

#

you have to use alignPosition