For my game, I really wanted to build a GUI that manipulates the camera so that it shows the map and the person would have to click a text box to continue. I know it would have to use the scriptable property of the camera in conjunction with the PlayerAdded event, but I'm really not quite sure how to go about it from there. Thanks in advance.
Scripting Cameras
1 answer
Guess by what you have written if someone is just clicking the text box and not typing any certain string then you should replace that with a Text Button. When scripting a Camera for the local player you have to have a Local Script inside of a Normal Script. Then to get that local script in side the players model you would use this.
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
script.LocalScript:clone().Parent = character
end)
end)
Inside the local script you would put what you wanted the camera to do for example: If you want the camera to attach to some type of part you would put this cam.CameraSubject=workspace.Part
Camera Type Would look like this
cam.CameraType = "Attach"
Coordinate Frame Would look like this
cam.CoordinateFrame=CFrame.new(10,10,10)
If you want it to circle a part you would do this
local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraSubject = target
local angle = 0
while wait() do
camera.CoordinateFrame = CFrame.new(target.Position) --Start at the position of the part
* CFrame.Angles(0, angle, 0) --Rotate by the angle
* CFrame.new(0, 0, -5) --Move the camera backwards 5 units
angle = angle + math.rad(1)
end
Fixing the Camera once your done when text box is clicked / button Assuming you already got the function onClick().
All of the scripts above that says local in it goes inside the local script.
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
Some of the information above was taken from the website Roblox Wiki Camera manipulation
This discussion is preserved as it was. New answers, comments, and votes are closed.
