Hello everybody! I am making a lazer light show, and I have a beam coming from a part into another part (as beams work). I would like the part to move between two parts smoothly, and obviously the beam will follow this block. This is my script:
local TweenService = game:GetService("TweenService")
local Start = game.Workspace:WaitForChild("Start")
local End = game.Workspace:WaitForChild("End")
local PartToMove = game.Workspace:WaitForChild("PartToMove")
local TweenInformation = TweenInfo.new(
0.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
5,
true,
1
)
local EndProperties = {
Position = End.Position
}
local StartProperties = {
Position = Start.Position
}
local TweenToPlay = TweenService:Create(PartToMove,TweenInformation,EndProperties)
local StartTweenToPlay = TweenService:Create(PartToMove,TweenInformation,StartProperties)
while true do
TweenToPlay:Play()
wait()
end
Currently , this only goes to the part named ‘End’, but I want it to travel in between Start and End constantly. Thanks for any help!
local PartToMove = game.Workspace:WaitForChild("PartToMove")
local Start = game.Workspace:WaitForChild("Start")
local End = game.Workspace:WaitForChild("End")
for i = 0,.5,.01 do
wait()
PartToMove.CFrame = start.CFrame:Lerp(End.CFrame,i)
end
-- I didnt test the code tell me if theres an errors
No this does not work? Not sure why, but a couple of your things inside the script did not match with the references you made at the start, so I edited them?