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

parts flying all over the place when tweening the position and orientation at the same time?

Asked by 1 year ago
Edited 1 year ago

as seen by this video here, The pins are flying all over the place when I tween the rotation and position at the same time. Why is this happening? Here is my code.

tweenmodule = require(game.ReplicatedStorage.TMmoduleV2)
db = false
local ts = game:GetService("TweenService")
eg = {}
eg.Position = Vector3.new(41.413, 10.676, 164.464)
eg.Orientation = Vector3.new(0,90,0)
local eg1 = {}
eg1.Position = Vector3.new(43.331, 10.676, 157.219)
eg1.Orientation = Vector3.new(0,90,0)
local eg2 = {}
eg2.Position = Vector3.new(45.215, 10.676, 164.464)
eg2.Orientation = Vector3.new(0,90,0)
local eg3 = {}
eg3.Position = Vector3.new(45.219, 10.676, 159.899)
eg3.Orientation = Vector3.new(0,90,0)
local eg4 = {}
eg4.Position = Vector3.new(46.937, 10.676, 162.233)
eg4.Orientation = Vector3.new(0,90,0)
local eg5 = {}
eg5.Position = Vector3.new(41.303, 10.676, 159.899)
eg5.Orientation = Vector3.new(0,90,0)
local eg6 = {}
eg6.Position = Vector3.new(37.991, 10.676, 164.464)
eg6.Orientation = Vector3.new(0,90,0)
local eg7 = {}
eg7.Position = Vector3.new(48.437, 10.676, 164.464)
eg7.Orientation = Vector3.new(0,90,0)
local eg8 = {}
eg8.Position = Vector3.new(43.326, 10.676, 162.233)
eg8.Orientation = Vector3.new(0,90,0)
local eg9 = {}
eg9.Position = Vector3.new(39.646, 10.676, 162.233)
eg9.Orientation = Vector3.new(0,90,0)
local Tweeninfo = TweenInfo.new(1.5, Enum.EasingStyle.Linear)
wait(1)
t1 = tweenmodule.TweenModulePosition(script.Parent.Model,TweenInfo.new(1.5,Enum.EasingStyle.Linear),Vector3.new(43.178, 5.643, 161.958))
wait(1.5)
d = script.Parent.Model:GetChildren()
for i,v in pairs(d) do
    v.Anchored = false
end

game.Workspace.TouchPart.Touched:Connect(function(hit)
    if hit.Name == "Rekt" then
        if db == false then
            db = true
        wait(1)
        for i,v in pairs(d) do
            v.Anchored = true
            v.CanCollide = false
        wait(1)
            local t1 = ts:Create(script.Parent.Model.Pin1, Tweeninfo, eg)
            local t2 = ts:Create(script.Parent.Model.Pin2, Tweeninfo, eg1)
            local t3 = ts:Create(script.Parent.Model.Pin3, Tweeninfo, eg2)
            local t4 = ts:Create(script.Parent.Model.Pin4, Tweeninfo, eg3)
            local t5 = ts:Create(script.Parent.Model.Pin5, Tweeninfo, eg4)
            local t6 = ts:Create(script.Parent.Model.Pin6, Tweeninfo, eg5)
            local t7 = ts:Create(script.Parent.Model.Pin7, Tweeninfo, eg6)
            local t8 = ts:Create(script.Parent.Model.Pin8, Tweeninfo, eg7)
            local t9 = ts:Create(script.Parent.Model.Pin9, Tweeninfo, eg8)
            local t10 = ts:Create(script.Parent.Model.Pin10, Tweeninfo, eg9)
            t1:Play()
            t2:Play()
            t3:Play()
            t4:Play()
            t5:Play()
            t6:Play()
            t7:Play()
            t8:Play()
            t9:Play()
            t10:Play()
            end
        end
    end
end)

after the line that detects if the touchpart was touched is where it is happening.

1 answer

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

See if this fixes the issue:

game.Workspace.TouchPart.Touched:Connect(function(hit)
    if hit.Name == "Rekt" then
        if db == false then
            db = true
            wait(1)
            for i,v in pairs(d) do
                v.Anchored = true
                v.CanCollide = false
            end
            wait(1)
            local t1 = ts:Create(script.Parent.Model.Pin1, Tweeninfo, eg)
            local t2 = ts:Create(script.Parent.Model.Pin2, Tweeninfo, eg1)
            local t3 = ts:Create(script.Parent.Model.Pin3, Tweeninfo, eg2)
            local t4 = ts:Create(script.Parent.Model.Pin4, Tweeninfo, eg3)
            local t5 = ts:Create(script.Parent.Model.Pin5, Tweeninfo, eg4)
            local t6 = ts:Create(script.Parent.Model.Pin6, Tweeninfo, eg5)
            local t7 = ts:Create(script.Parent.Model.Pin7, Tweeninfo, eg6)
            local t8 = ts:Create(script.Parent.Model.Pin8, Tweeninfo, eg7)
            local t9 = ts:Create(script.Parent.Model.Pin9, Tweeninfo, eg8)
            local t10 = ts:Create(script.Parent.Model.Pin10, Tweeninfo, eg9)
            t1:Play()
            t2:Play()
            t3:Play()
            t4:Play()
            t5:Play()
            t6:Play()
            t7:Play()
            t8:Play()
            t9:Play()
            t10:Play()
        end
    end
end)
0
ty man bittyboy1234 91 — 1y
0
OH LOL, I HAD THE TWEENS IN A LOOP LOL bittyboy1234 91 — 1y
Ad

Answer this question