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

How to move a players camera once a part is touched?

Asked by 5 years ago
Edited 5 years ago

I'm trying to move the players current camera to the position of a part. I have the part where you can move between the cameras but no way to activate it when the player hits a certain part using a touched function. I also have a second problem, So say i was clicking the previous button to move to the previous item but there is no item. If you click it more than once you cant go back unless you click it untill its back to 1 the first camera. button I've been trying for about 45 minutes now and i really cant seem to figure it out. If anyone would like to support me that would be thankful of you :)

Here's my script (You click a button it moves between the Cameras):

01local Workspace = game:GetService("Workspace")
02local Players = game:GetService("Players")
03local TweenService = game:GetService("TweenService")
04local CurrentCamera = Workspace.CurrentCamera
05 
06local Next = script.Parent.Parent.Parent.Parent.Shop:WaitForChild("Next")
07local Previous = script.Parent.Parent.Parent.Parent.Shop:WaitForChild("Prev")
08 
09local CurrentItem = 1
10local Finished = nil
11 
12    Finished = Workspace.Cameras[CurrentItem]
13    local TweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)
14    local Goal = {CFrame = CFrame.new(Finished.Position)}
15    local Tween = TweenService:Create(CurrentCamera, TweenInfo, Goal)
View all 50 lines...

Answer this question