#Model:PivotTo() Orientation

87 messages · Page 1 of 1 (latest)

arctic maple
#

Studio

#

In game

#
--Setting UP Script
local CX, CY, CZ = script.Parent.PrimaryPart.CFrame.X, script.Parent.PrimaryPart.CFrame.Y, script.Parent.PrimaryPart.CFrame.Z
local db = false
local Part = script.Parent
Part:PivotTo(CFrame.new(999999999,99999999999,99999999999))

--Setting Up Variables
local quan = 5
--local tim = 30
--local maxRng = 10
local tim = 1
local maxRng = 1
wait(5)
-- Checking if its a private server 
local PRIVATE = game.Workspace.IsPrivate

if not PRIVATE.Value then
    wait(tim + math.random(0,maxRng))
    --Part:SetPrimaryPartCFrame(CFrame.new(CX, Part.PrimaryPart.CFrame.Y, Part.PrimaryPart.CFrame.Z))
    --Part:SetPrimaryPartCFrame(CFrame.new(Part.PrimaryPart.CFrame.X,CY,Part.PrimaryPart.CFrame.Z))
    --Part:SetPrimaryPartCFrame(CFrame.new(Part.PrimaryPart.CFrame.X,Part.PrimaryPart.CFrame.Y,CZ))
    Part:PivotTo(CFrame.new(CX,CY,CZ))
    
    --Touch event
    Part.PrimaryPart.Touched:Connect(function(hit)
        
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        if plr and db == false then

            db = true
            local Corns = plr:WaitForChild("Stats"):FindFirstChild("ccorn")
            Corns.Value += quan
            Part:PivotTo(CFrame.new(999999999999,99999999999,999999999999))
            wait(tim + math.random(0,maxRng))
            Part:PivotTo(CFrame.new(CX,CY,CZ))

            db = false
        end
    end)
end
#

Script:

spiral granite
#

Dont use PivotTo()

arctic maple
#

then?

spiral granite
#

Use tween

arctic maple
#

huh

spiral granite
#

TweenService

#

Have u never heard of this?

arctic maple
#

yes

#

uhhh, ima test

arctic maple
#

Like this?

spiral granite
#

Yea

#

Then

#

do this

arctic maple
#

i need to create 2 tweens

spiral granite
#
local tweenInfo = TweenInfo.new(0,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,0)

local tween1 = game:GetService("TweenService"):Create(PUT THE VARIABLE FOR THE INSTANCE U WANT TO TWEEN HERE., tweenInfo, {CFrame = CFrame.new()})
tween1:Play()
arctic maple
#

works tho?

spiral granite
#

Yes

#

Im pretty sure

arctic maple
#

Uhhh

spiral granite
#

Model doesnt have CFrame property

#

Do a part

#

U can do primary part

arctic maple
#

the primary part?

spiral granite
#

Yes

arctic maple
#

i will try

spiral granite
#

OK

#

KO

#

OK

#

OKKO

arctic maple
#

uhhhh

spiral granite
#

OKOKOKOKOKOKOKOK

arctic maple
#

only moves the primary part

#

the others ones nope

spiral granite
#

Try this

arctic maple
#

also the orientation changes too

#

i dont want to change it

spiral granite
#
local tweenInfo = TweenInfo.new(0,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut,0,false,0)

for i, part in model:GetChildren() do
if part:IsA("BasePart") then continue end
local tween1 = game:GetService("TweenService"):Create(part, tweenInfo, {Position = Vector3.new()})
tween1:Play()
end
#

Uh

#

Now

arctic maple
#

then, i need to get all the parts vector3

spiral granite
#

Yea..

#

Uhm

#

Try another thing

#

Weld every part to the Primarypart

arctic maple
#

ima try

#

so, vector3 instead cframe?

spiral granite
#

Yea

#

Cuz CFrame changes orientation too

#

CFrame = CoordinateFrame

#

= Changes every coordinate to the give coordinate

arctic maple
#

welded everything

#

ima test again

spiral granite
#

Oki

arctic maple
#

for now, none errors in the console

spiral granite
#

And it works?

arctic maple
spiral granite
#

Works??

#

Idk if that is working

arctic maple
#

nope, the middle candy corn dissapeared

#

(the primary one)

spiral granite
#

Hm

#

Why

#

?

arctic maple
#

idk why is not working

spiral granite
#

It got deleted or it was tweened?

arctic maple
#

uhhh

#

idk at all

arctic maple
#

yes

spiral granite
arctic maple
#

there's a problem

#

i need to do the same with a Crate of Candy Corns

#

and the crate has like 50 parts-

#

@spiral granite so... Ima use again pivotTo

#

idc now abt orientations

#

i need to release the halloween update now

#

today*

spiral granite
#

Okay

#

What game is it?

arctic maple
#

Fling Simulator, why?