Greeting everyone! I have a question to ask.
I’m very new to scripting, and I really need to find out how to script so I can be advanced and make the games that I need to make. If you have suggestions on where to start scripting and where I can learn
Also, please do not suggest outdated channels, or channels that doesn’t explain the script, they just type it and call out the words and put the whole script in the description of theirs video.
But anyway, to the main question. How can I make these 3 lasers move up and down?
Hey! When I started out learning Roblox and what it could offer, I found CFrames to be a rather difficult concept to grasp when not exposed to a similar concept. Here are some resources that helped me understand what CFrames are and how it works.
For this particular case, you could use TweenService or CFrame:Lerp.
Here’s an example for you using TweenService:
local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
-- More can be found here: https://developer.roblox.com/en-us/api-reference/function/TweenService/Create
local Part = -- Part that you want to animate
local goal = {} -- Contains all properties that you want your tween to change
goal.Position = Vector3.new(x,y,z) -- x (left, right), y (up, down), z (forwards, backwards) -- A property (can also use CFrames but, I don't think you wanted rotation)
local Tween = TweenService:Create(Part, TweenInfo, goal) -- creates a tween with 'part' using TweenInfo that reaches 'goal.Position'
Tween:Play() -- Plays tween you created above
Hey there.
I would suggest using :TranslateBy() or CFrame:Lerp() for this type of thing.
Since you are a new scripter, I would suggest learning about CFrames (or vector3s) before trying to attempt this. Read about it on the ROBLOX Wiki.
Workspace.Part.Script:14: Expected identifier when parsing expression, got ‘local’ - Studio - Script:14
Line 14 is: local goal = {} – Contains all properties that you want your tween to change
I don’t know what to do with this “{ }” and I keep getting this error