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

Union Box is going brrr and not smoothly while in tweenmovement?

Asked by 2 years ago
Edited 2 years ago

This script is moving a box, full of unanchored cubes, and the box keeps going all sijnhfdibdsfi, and not staying upright. How do I make the box stay upright?

local ts = game:GetService("TweenService")
local p1 = script.Parent.Parent.rollmove.RI
local p2 = script.Parent.Parent.rollmove.RII
local box = script.Parent.Parent.rollmove.Box
local click = script.Parent.ClickDetector

local function roll()
    script.Parent.SurfaceGui.Rolling.Visible = true
    script.Parent.SurfaceGui.Roll.Visible = false
    wait()
    local function moveItem(item, wp)
        local ti = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
        local tween = ts:Create(item, ti, { Position = wp.Position})
        tween:Play()
        wait(2)
    end
    moveItem(box, p1)
    moveItem(box, p2)
    local tragetcframe = CFrame.Angles(0,math.rad(90),0)
    box.CFrame = tragetcframe
    moveItem(box, p1)
    script.Parent.SurfaceGui.Rolling.Visible = false
    script.Parent.SurfaceGui.Roll.Visible = true
end

click.MouseClick:Connect(roll)

If you can, can you tell me how to rotate the box upsidown so i can pour the cubes? (which are dice lol)

0
Is the box unanchored? sne_123456 439 — 2y
0
Ok so anchor the box and put the below code in a script sne_123456 439 — 2y
0
The script goes in workspace sne_123456 439 — 2y
0
And if my answer fix the problem, please mark it as answered sne_123456 439 — 2y
View all comments (4 more)
0
the dice arent staying in the box when it moves, is there a way to fix that? Jakob_Cashy 79 — 2y
0
also, the box is being sent to the middle of the baseplate with ur extra script?? it didnt turn also? im also trying to make it so it only turns when it gets to p2 in the tween Jakob_Cashy 79 — 2y
0
oh k sne_123456 439 — 2y
0
If that is the case use orientation and vector3 sne_123456 439 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

Hi, If the box is unanchored that will happen, so make sure to anchor the box that are carrying the dice! And to rotate the box upside down, you can use CFrame.Angles().

so if you want to box to rotate 90 degrees on the Y-Axis, you can just write in this simple code!


local box = game.worspace.Box tragetcframe = CFrame.Angles(0,math.rad(90),0) box.CFrame = targetcframe -- always use math.rad to define an angle in Cframe.Angles!!

put this code in a script in workspace

0
where do i put this code? also yes the box was unachored Jakob_Cashy 79 — 2y
0
sne can u accept my fren request so we can do team create? Jakob_Cashy 79 — 2y
0
ok sne_123456 439 — 2y
Ad

Answer this question