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

Trying to get a Value from a certain child?

Asked by
DBoi941 57
5 years ago
Edited 5 years ago

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
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? Amiaa16 3227 — 5y
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. DBoi941 57 — 5y
0
print type (newblock.BrickColor = BrickColor.new("Alder")) to figure it out superyoutuberkid -4 — 5y

Answer this question