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

I need help with position/cframe stuff?

Asked by
VitroxVox 884 Moderation Voter
5 years ago
Edited 5 years ago

Let's start off with I'm really bad with cframe and position stuff, i've made a gate that opens & closes but because i'm not really a genius i made it for a specific position the problem with this is that if i put the gate somewhere else it won't work, so i need help to make it use the position of the gate and lower it , then lift it!

Current script:

01local TweenService = game:GetService("TweenService")
02local tweenInfo = TweenInfo.new(
03    5, -- Time
04    Enum.EasingStyle.Linear, -- EasingStyle
05    Enum.EasingDirection.Out, -- EasingDirection
06    -1, -- RepeatCount (when less than zero the tween will loop indefinitely)
07    true, -- Reverses (tween will reverse once reaching it's goal)
08    0) --delay time
09 
10function opengate()
11 
12local tween = TweenService:Create(gate, tweenInfo, {Position = Vector3.new(53.315, 14.45, 46.329)})
13 
14tween:Play()
15wait(5)
View all 27 lines...

I didn't include some stuff in the script such as the remote event and the part that says where the gate is cause it's pretty useless, the gate is a part.

1 answer

Log in to vote
1
Answered by
St_vnC 330 Moderation Voter
5 years ago

To move the gate with CFrame you do CFrame.new

1for i = 1,99,1 do
2      gate.CFrame = CFrame.new(gate.CFrame.X,gate.CFrame.Y + .1,gate.CFrame.Z)
3      wait()
4end
5gate.CFrame = CFrame.new(gate.CFrame.X,14.45,gate.CFrame.Z) --This makes nothing is out of place

Actually think Tweening is more useful than CFrame in this context

Ad

Answer this question