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

Problem with tweenservice how could I fix it ? (Output dosen't shows errors)

Asked by 5 years ago

Hello I tried to make a SCPF door by using tween service but it is changing always the oriantation how can I fix this?

https://gyazo.com/97fb56adb2d2600068b90a5016741d97

My script:

local door1 = script.Parent.Door1
local move = script.Parent.DoorMove
local debounce = false

function open()
    local tweeninformation = TweenInfo.new(
        4,
        Enum.EasingStyle.Linear,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )
    local pos = {CFrame = CFrame.new(move.Position)}
    local tweencreate = game:GetService("TweenService"):Create(door1, tweeninformation, pos)
    tweencreate:Play()
end

script.Parent.KeyCardReader1.Touched:Connect(function(Handle)
    if Handle.Name == "Handle" and script:FindFirstChild(Handle.Parent.Name).Value == true then
        open()
    end
end)
0
You're a Lua god and you're asking for help on a simple roblox script???? User#24403 69 — 5y
0
Exactly my thought when I saw this question. User#25115 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

The problem here is that your target CFrame is a position only CFrame that doesn't take into account the door's current orientation.

You can fix this by making sure that your target CFrame is relative to the door's starting CFrame, meaning, a CFrame that's translated a few studs to the... right, since I'm assuming you want it to slide.

There are a ton of guides about CFrames out there, but I think the * constructor part in this is what you'll need.

Hope that helps!

0
How would I do that in a script? GodOf_Lua 25 — 5y
0
It is just I don't use CFrame that much GodOf_Lua 25 — 5y
0
Take the current CFrame, then use the * constructor to "translate" it by another CFrame. There are a lot of guides about CFrames and CFrame manipulation out there, lemme edit the post to add those on real quick Aniline_Purple 266 — 5y
Ad

Answer this question