Problem it is going to the first land and not the one that has the players name. I need it to pull the Value from "ColorValue" and "MaterialValue" that's inside that players land. So when I wright "= land.ColorValue.Value" its going to the first child not the one by name so I get an error saying that = ColorValue isn't there.

local player = game.Players.LocalPlayer
B2b = require(game.ServerScriptService.Blocks.B2B)

Block = {}
Block.__index = Block
setmetatable(Block, B2b)

function Block.new(...)
    local newblock = B2b.new(...)
    setmetatable(newblock, Block)
	
	for _, land in pairs(workspace.Buildings:GetChildren()) do
		if land.Name.Value == player then
				newblock.blockColor = land.ColorValue.Value
				newblock.blockMaterial = land.MaterialValue.Value
			end
		end
		return newblock
	end
return Block

3 comments

0

?? I can't understand you. I don't get what you're asking for. Maybe I could figure out what you mean if you posted i.e. the part where you define newblock and player?

0

I updated the code. It will work if I do this: newblock.blockColor = BrickColor.new("Alder") but I need it to get the color Value from Stringvalue that is stored on the players land model.

0

print type (newblock.BrickColor = BrickColor.new("Alder")) to figure it out