How do i convert this to FE? I got a brick inside the model that i could drag, it's supposed to be the main detector of parts so when a player placed the model on a area where there is parts it will not allow it.
This is the brick detector script.
_G.detected = nil while wait() do local d = script.Parent local pos = d.Position local size = d.Size/2 local reg = Region3.new(pos - size, pos + size) local p = script.Parent.Parent local ignore = {workspace.Baseplate,d,p} local n = workspace:FindPartsInRegion3WithIgnoreList(reg,ignore,100) if #n <= 0 then _G.detected = false else _G.detected = true _G.down = true end end
Then on a player starterpack i got localscript for the main dragging, this is just part of it where assuming a player is dragging the model and released the button, we know that the brick detector will set detected to true if there is part so it'll not allow it, if detected is true then model will remain as mouse target.
mouse.Button1Up:connect(function() pcall(function() if (player.Character.Torso.Position - mouse.Target.Position).magnitude >= 100 or _G.detected == true then _G.down = true _G.target = mouse.Target.Parent script.Parent.Parent.PlayerGui.Warning.Enabled = true _G.selectionBox = Instance.new("SelectionBox") _G.selectionBox.Adornee = mouse.Target.Parent _G.selectionBox.Color3 = Color3.fromRGB(255,0,0) _G.selectionBox.Parent = camera else _G.selectionBox.Adornee = nil _G.selectionBox.Parent = nil mouse.TargetFilter = nil _G.down = false _G.target = nil script.Parent.Parent.PlayerGui.Warning.Enabled = false _G.selectionBox.Color3 = nil end end) end)
THE PROBLEM
the region detector doesn't work in-game only on studio. I can't think of any reason why maybe converting the detector script to F.E will fix but i don't know how..