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

Whats up with my part script, has it gone insane!?

Asked by 8 years ago

So I have a incredibly simple script to create a part and set a few of its values.

    local NewPart = Instance.new("Part")
    NewPart.Parent = Model
    local newPartName = "NewPart"
    NewPart.Name = newPartName
    local newPartCFrame = CFrame.new(0,1.5,0,1,0,0,0,1,0,0,0,1)
-- [[   (The CFrame above consists of the three position values x,y,z and the nine values of the rotation matrix)
--]]
    NewPart.CFrame = newPartCFrame
    local newPartSize = Vector3.new(50,1.2,50)
    NewPart.Size = newPartSize
    NewPart.Anchored= true

Ya, looks simple enough but what happens when I run the script confuses me completely.

The results of the script were:

--1.The part is placed into the workspace,----Yes"
--2.The part is named correctly, ----"Yes"
--3.The parts Position is set to Vector3.new(-0.038, 2.704, -0.131),----"Huh?"
--4.The parts Rotation is set to Vector3.new(0.823, -30.692, 0.016),----"What?"
--5.The parts RotVelocity is set to  Vector3.new(5.49, 0.009, 3.413),----"What the heck!"
--6. The parts Velocity is set to Vector3.new(-2.048, 8.344, 3.261),----"What the fudge!"
--7. The part is Anchored correctly.----"Yes"

As you can see the results of the script were far from what I told it to do. I told it to change the position and rotation to simple values and it changed them to randomly complex values! I DID NOT tell it to do anything with the RotVelocity or the Velocity but it changed them as well!

Note: I did try this script several more times with different values but the results did not change the random chaos.

Does anyone know why this is happening and how to fix it!?

0
I'm not sure as I'm horrid at CFraming-but possibly you could try anchoring the part right after you make it, not before it ends. Is it ending up in the right spot? Maybe it's flinging around before you anchor it? unmiss 337 — 8y
0
Hmm thats a possibliity, I woudn't think unanchoring the part would mess with it's velocity, but I'll try it anyway. ClassicTheBlue 65 — 8y
0
Omg it worked... Thanks Jackctaylor! ClassicTheBlue 65 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

I'm not sure as I'm horrid at CFraming-but possibly you could try anchoring the part right after you make it, not before it ends. Is it ending up in the right spot? Maybe it's flinging around before you anchor it? (({{[[JACKCTAYLOR ANSWERED THIS QUESTION]]}}))

Ad
Log in to vote
-3
Answered by
snow29 0
8 years ago

First define model, second Typos., 'Nuff said.

Answer this question