Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script Error About Part Orientation?

I got an error from this script saying " Orientation is not a valid member of Vector3"

How Can I fix this?

mouse = game.Players.LocalPlayer:GetMouse()
Part = game.Workspace.Part.Orientation

function onKeyDown( key )
    if key == "d" then
		while true do
			Part.Orientation = Part.Orientation + Vector3.new(0,1,0)
				if Part.Orientation == Vector3.new(0,45,0)
			    then break end
				wait()
			end
		end
		if key == "a" then
				while true do
					Part.Orientation = Part.Orientation + Vector3.new(0,-1,0)
					if Part.Orientation == Vector3.new(0,-45,0)then
						break
					end
			wait()
		end
	end	
end
mouse.KeyDown:connect(onKeyDown)

1 comment

0

Don't use while true do, it will yield the entire script when it runs.

1 answer

Extremely easy fix, you just made a small typo.

You said local Part = game.Workspace.Part.Orientation(just do workspace.Part, it's a lot easier)

Just remove the Orientation off the end like so:

local mouse = game.Players.LocalPlayer:GetMouse()
local Part = game.Workspace.Part

function onKeyDown( key )
    if key == "d" then
        while true do
            Part.Orientation = Part.Orientation + Vector3.new(0,1,0)
                if Part.Orientation == Vector3.new(0,45,0)
                then break end
                wait()
            end
        end
        if key == "a" then
                while true do
                    Part.Orientation = Part.Orientation + Vector3.new(0,-1,0)
                    if Part.Orientation == Vector3.new(0,-45,0)then
                        break
                    end
            wait()
        end
    end
end

mouse.KeyDown:connect(onKeyDown)

This discussion is preserved as it was. New answers, comments, and votes are closed.