Ad
Log in to vote
0

How do I fix "Position is not a valid member of Workspace"?

Asked by 8 days ago
Edited 8 days ago

I'm currently learning scripting and so how do I fix this?

myvariable = 10

if (myvariable == 10) then  -- Brick Movement and Properties

    game.Workspace.Brick.BrickColor = BrickColor.new("Bright red")
    game.Workspace.Brick.Anchored = true

    game.Workspace.Brick.Position = Vector3.new(0,10,0)  
print("Sucsess")

end

function MoveBrick (name) -- Move Brick
    game.Workspace.Position = game.Workspace.Brick.Position + name
end

function Calculation (number1,number2) -- Calculation
    local result = number1 + number2
    return result
    end

MoveBrick (Vector3.new (5,0,0))
CalculationResult1 = Calculation (6,2)
CalculationResult2 = Calculation (40,29)
print(CalculationResult1)
print(CalculationResult2)       

0
You meant workspace.Brick* Ziffixture 6548 — 8d

2 answers

Log in to vote
0
Answered by 8 days ago
Edited 8 days ago

Line 14, Workspace does not have a property for positions.

function MoveBrick (name) -- Move Brick
    game.Workspace.Position = game.Workspace.Brick.Position + name
--          /\/\     /\/\
end

I'm assuming is that you want to move the brick part, if so, this is just a simple error.

function MoveBrick (name) -- Move Brick
    game.Workspace.Brick.Position = game.Workspace.Brick.Position + name
--  This should work!
end

If this isn't what you wanted to do, well... I don't know.

0
Oh Sorry I should have looked more into the script, Scripting is just an overcomplicated list of things the game does ???? Greninja90290 4 — 7d
Ad
Log in to vote
0
Answered by
A_Mp5 146
8 days ago

that script is just a jumled mess- nobody will be able to fix that.....

Answer this question