Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Roses Are Red, Violets Are Violet. CopyRegion or PasteRegion doesn't work. Help?

Asked by 6 years ago
local TrapPosses1 = game.Workspace.Trap1
local T1P1 = TrapPosses1.Part1.Position/4
local T1P2 = TrapPosses1.Part2.Position/4
local MinPos = Vector3int16.new(math.floor(math.min(T1P1.X,T1P2.X)),math.floor(math.min(T1P1.Y,T1P2.Y)),math.floor(math.min(T1P1.Z,T1P2.Z)))*4
local MaxPos = Vector3int16.new(math.ceil(math.max(T1P1.X,T1P2.X)),math.ceil(math.max(T1P1.Y,T1P2.Y)),math.ceil(math.max(T1P1.Z,T1P2.Z)))*4
local TrapReg1 = Region3int16.new(MinPos,MaxPos)
Trap1 = TS:CopyRegion(TrapReg1)


Tool.Equipped:Connect(function(Mouse)
    curfunc = Tool.Activated:Connect(function()
        local Pos = Mouse.Hit.p
        local MainAdd = (TrapReg1.Max - TrapReg1.Min)/2
        local WillTransform = Pos + Vector3.new(MainAdd.X,0,MainAdd.Z)
        local PasteTo = Vector3int16.new(WillTransform.X,WillTransform.Y,WillTransform.Z)
        TS:PasteRegion(Trap1,PasteTo,false)
    end)
end)

Well guys, please do not say "It's 2018 who uses tools lel" because I am just testing, trying to understand mechanics of terrain copying and pasting. In the code I sent, I create a Region3int16 and copy a terrain at the start. Then paste it to somewhere I click with tool. Somehow it doesn't paste. I wrote print at, like, everywhere. It prints everywhere, even after PasteRegion function, and I get no errors.

I think it either does not copy, or am I using wrong parameters? Any other ideas that would cause this to not work?

Answer this question