FE Dragger Instance?

Working on creating a FilteringEnabled copy of the Build To Survive Drakobloxxers recreation I made. I think I got mostly everything, but I just need to figure out how to make the old build tools work.

It’s easy enough to get a semi-working version of it just by positioning parts at mouse.Hit.p, but it doesn’t exactly replicate the behavior of the Dragger object.

FE Version that doesn’t work right:
https://gyazo.com/a1a4e8cab6d51e34c29c5c6f6ece4289

Draggar version that works well
https://gyazo.com/6b090f489d400e436f41e7e97bfc6516

Really not sure what I can do aside from spending hours trying to replicate the dragger behavior. Does anybody have a FilteringEnabled version of building tools they’re willing to make public? Or alternatively, a recreation of the Dragger object?

Localscript Clone Code
local ReplicatedStorage = game:GetService("ReplicatedStorage")

debounce = false
local vPlayer = game.Players.LocalPlayer
local SBox = Instance.new("SelectionBox")
local Tool = script.Parent;
local Select = nil
local Camera = workspace.CurrentCamera

local ignoreList = {}

local function GetMousePosIgnore(pos)
	local ray = Camera:ScreenPointToRay(pos.X, pos.Y, 1)
	ray = Ray.new(ray.Origin, (ray.Unit.Direction*999))
	local hit, hitPos, normal = workspace:FindPartOnRayWithIgnoreList(ray, ignoreList, true, false)
	return hitPos
end

function onButton1Down(mouse)
	local Target = mouse.Target
	local Sound = Instance.new("Sound")-- The "ding" sound
	Sound.SoundId = "rbxasset://sounds\\electronicpingshort.wav"
	Sound.Name = "PewPew"
	Sound.Parent = Tool

	if Target and Target:IsA("BasePart") and not Target.Locked then
		if debounce == false then
			debounce = true
			local pos = Target.Position+Vector3.new(0,0.4,0)
			Select = game.ReplicatedStorage.ClonePart:InvokeServer(Target, pos)
			mouse.TargetFilter = Select
			SBox.Adornee = Select
			Sound:Play()
			--wait(1.5)-- Edit this to how long you would like to wait until the next copy
			mouse.Icon = "rbxasset://textures\\DragCursor.png"
			debounce = false
		end
	end
end

function onButton1Up(mouse)
	if Select then
		ReplicatedStorage.MouseUp:FireServer()
		SBox.Adornee = nil
		Select = nil
		mouse.TargetFilter = nil
		mouse.Icon = "rbxasset://textures\\CloneOverCursor.png"
	end
end

function onMouseMove(mouse)
	if Select then
		mouse.Icon = "rbxasset://textures\\GrabRotateCursor.png"
		if mouse.Target then
			ReplicatedStorage.MouseDragged:FireServer(mouse.Hit.p)
		end
	else
		local Target = mouse.Target
		if Target and Target:IsA("BasePart") and not Target.Locked then
			mouse.Icon = "rbxasset://textures\\CloneOverCursor.png"
		else
			mouse.Icon = "rbxasset://textures\\CloneCursor.png"
		end
	end
end

function onKeyDown(key)
	key = key:lower()
	if key == 'r' then
		ReplicatedStorage.RotatePart:FireServer("R")
	elseif key == 't' then
		ReplicatedStorage.RotatePart:FireServer("T")
	end
end

function onEquippedLocal(mouse)
	SBox.Color = BrickColor.new("Cyan")
	SBox.Parent = vPlayer.PlayerGui

	mouse.Button1Down:connect(function() onButton1Down(mouse) end)
	mouse.Button1Up:connect(function() onButton1Up(mouse) end)
	mouse.Move:connect(function() onMouseMove(mouse) end)
	mouse.KeyDown:connect(onKeyDown)
end

function onUnequippedLocal(mouse)
	if Tool:findFirstChild("PewPew") then
		Tool.PewPew:Destroy()
	end
	SBox.Adornee = nil
	Select = nil
end

Tool.Equipped:connect(onEquippedLocal)
Tool.Unequipped:connect(onUnequippedLocal)
Server script remotes
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ClonePart = ReplicatedStorage:WaitForChild("ClonePart")
local MouseDragged = ReplicatedStorage.MouseDragged
local RotatePart = ReplicatedStorage.RotatePart
local MouseUp = ReplicatedStorage.MouseUp

local DraggingParts = {}

local function RoundToNearest(number, multiple)
	local half = multiple/2
	return number+half - (number+half)%multiple
end

local function GetGridPos(pos, size)
	local offset = size.X%2*0.5
	local x = offset+RoundToNearest(pos.X, 1)
	local y = 0.8+RoundToNearest(pos.Y, 1.2)
	local z = offset+RoundToNearest(pos.Z, 1)
	
	return Vector3.new(x,y,z)
end

ClonePart.OnServerInvoke = function(player, part, pos)
	local c = part:clone()
	c.Parent = workspace
	c.Position = GetGridPos(pos, c.Size)
	DraggingParts[player.Name] = c
	return c
end

MouseDragged.OnServerEvent:Connect(function(player, pos)
	local part = DraggingParts[player.Name]
	if part then
		part.Position = GetGridPos(pos, part.Size)
	end
end)

MouseUp.OnServerEvent:Connect(function(player)
	DraggingParts[player.Name] = nil
end)

RotatePart.OnServerEvent:Connect(function(player, key)
	local part = DraggingParts[player.Name]
	if part then
		--local cf = part.CFrame
		if key == "R" then
			part.CFrame = part.CFrame*CFrame.new(0,math.rad(90),0)
			part.Position = part.Position
		elseif key == "T" then
			part.CFrame = part.CFrame*CFrame.new(0,0,math.rad(90))
			part.Position = part.Position
		end
	end
end)
1 Like

Clonetrooper released a FE-compatible set of build tools recently:

You should be able to use these.

3 Likes

Oh yay! They’re not perfect (i.e. cloning parts inside of the target part, or moving welding parts while dragging, or welding to your character accidentally, and a few more), but they work well enough I think.

So a decent enough copy of the game, although it was better without FilteringEnabled.

Thanks for the help.