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

Help with figuring out why suitcase is rotating when being Cframed?

Asked by 4 years ago

Alright, I've been trying to figure this Cframe thing out for a while. I've narrowed it down to this one script because it's the only one that has position in it. Here's the code:

--Luk_ee

game.ReplicatedStorage.BaggageClaim.BagClaim.OnServerEvent:connect(function(plr, luggage, machine)
        local destbrick = game.Workspace.BaggageDropDest

        local function destination()
            luggage.Handle.Position = destbrick.Position + Vector3.new(0, 5, 0)
            wait()
            luggage.Handle.CanCollide = true
            wait()
            luggage.Handle.Anchored = false
        end

        if game.ReplicatedStorage.BaggageClaim.WrongDir.Value == false then

        luggage.Handle.Position = machine.Position + Vector3.new(0, 0, 0)
        luggage.Handle.Orientation = Vector3.new(0, 090, 0)
        luggage.Handle.CanCollide = false
        luggage.Parent = workspace
        luggage.Handle.Anchored = true
        wait(2)
        machine.Parent:FindFirstChild("StatusLight").Color = Color3.fromRGB(0,255,0)
        wait(1)
        for i = 1,40 do
        luggage.Handle.CFrame = CFrame.new(luggage.Handle.Position + Vector3.new(-0.1,0,0))--Right here.
print(luggage)
        wait()
        end
        machine.Parent:FindFirstChild("StatusLight").Color = Color3.fromRGB(255,255,255)
        wait()
        destination()

        else
        print("error")
        end




end)

I think it's the Cframe part where it changes the position to move it, Can I make it so it also rotates, does CFrame cover rotation, can I add rotation to the same line, or does it need to be on another line below? Please help.

Answer this question