function module.Mine(params) local mainFolder = Instance.new('Folder', params.Parent)…
- User
function module.Mine(params) local mainFolder = Instance.new('Folder', params.Parent) mainFolder.Name = 'Mine' local startPosition = snappedPosition(rPos(), 4) type PositionData = { position :Vector3, direction :Vector3, previousParts :number, attemts :number?, } local positions:{PositionData} = {} table.insert(positions, { position = startPosition, previousParts = 0, direction = -Vector3.zAxis, }) local functions = { Hallway = { func = function(params:PositionData) local leight = 16 local widthAndHeight = 12 local regionStartPos = params.position - Vector3.new(.5, 0, .5) * widthAndHeight local regionStartPos = params.position + Vector3.new(.5widthAndHeight, leight, .5widthAndHeight) local region = Region3.new(regionStartPos, regionStartPos + Vector3.new(widthAndHeight, leight, widthAndHeight)) Terrain:FillRegion(region, 4, region) --[[ type spawnFunctionParams = { Model:Instance, Parent:Instance, WeldTo:BasePart?, CFr:CFrame?, InoreList:{Instance}?, CFrFunc:()->CFrame, InTerrain:boolean?, WithOutTouchs:boolean?, NoRotate:boolean?, MackeWeldToTerrain:boolean?, NotMackeWeldToWeldTo:boolean?, Attempts:number, } ]] module.spawn({ Model = GetTaggedIn('mineSupport', AdditionalModels:GetChildren()), Parent = mainFolder, CFr = CFrame.new(params.position, params.direction) * CFrame.new(Vector3.zAxis*-leight/2), }) end, type = 'Hallway', Weight = 15, }, Deadlock = { func = function(params:PositionData) return true end, type = 'Deadlock',--тупик Weight = 1 }, Crossroad = { func = function(params:PositionData) params.previousParts += 1 return true, params end, type = 'Crossroad',--перекрёсток Weight = 5 }, } while #positions > 0 do local positionDataIndex = #positions local positionData = positions[positionDataIndex] local generPartFuncData if positionData.attemts and positionData.attemts > 50 then table.remove(positions, positionDataIndex) end if positionData.previousParts == 0 then generPartFuncData = functions.Crossroad elseif positionData.previousParts < 25 + math.random(5) then generPartFuncData = GetRandomElementByWeight(functions) else generPartFuncData = functions.Deadlock end local result, newPositions = generPartFuncData.func(positionData) positionData.attepts = (positionData.Attempts or 0) + 1 if result == true then table.remove(positions, positionDataIndex) for _, newPosition in newPositions do table.insert(positions, newPosition) end elseif not result then continue else error(
invalid result from function {generPartFuncData}) end end end attemts is not a valid member of Vector3 почему? - Assistant
The error message you're receiving, "attemts is not a valid member of Vector3", indicates a problem with how the code is attempting to access or modify the
attemtsfield of aPositionDatarecord. This issue is likely due to a typo and inconsistent case sensitivity in variable names.