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

Script Error About Part Orientation?

Asked by 6 years ago

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)
0
Don't use while true do, it will yield the entire script when it runs. PolyyDev 214 — 6y

1 answer

Log in to vote
0
Answered by
PolyyDev 214 Moderation Voter
6 years ago

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)

Ad

Answer this question