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

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

Asked by 3 years ago
Edited 3 years 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 6913 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years 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 — 3y
0
script is LuaU code designed to tell the game what you want it to do NGC4637 602 — 3y
Ad
Log in to vote
0
Answered by
A_Mp5 222 Moderation Voter
3 years ago

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

Answer this question