Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

2 comments

0

You're a Lua god and you're asking for help on a simple roblox script????

0

Exactly my thought when I saw this question.

1 answer

✓ Accepted answer

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!

3 comments

0

How would I do that in a script?

0

It is just I don't use CFrame that much

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

This discussion is preserved as it was. New answers, comments, and votes are closed.