-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExample.client.lua
More file actions
112 lines (95 loc) · 3 KB
/
Example.client.lua
File metadata and controls
112 lines (95 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
--\\----- [EXAMPLES FOR CAMERASERVICE] -----//--
--[[
Script for the demo place, showcasing how one can use CameraService.
By @Lugical
--]]
local CameraService = require(script.Parent:WaitForChild("CameraService"))
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local ui = playerGui:WaitForChild("ScreenGui")
local uiButton = ui.TextButton
local function resetToNormal()
uiButton.Visible = false
game.Lighting.DepthOfField.Enabled = false
game.Lighting.ColorCorrection.Saturation = -0.2
game.Lighting.ColorCorrection.Contrast = 0.2
CameraService:LockCameraPanning(false, false)
CameraService:ChangeSensitivity(1)
if player.Character then
player.Character.Humanoid.WalkSpeed = 16
end
CameraService:ChangeFOV(70, false)
end
CameraService:SetCameraHost()
CameraService:SetCameraView("ThirdPerson")
resetToNormal()
--[[ 2D platformer
local info = {
Smoothness = 3,
CharacterVisibility = "All",
MinZoom = 15,
MaxZoom = 15,
Zoom = 15,
AlignChar = false,
Offset = CFrame.new(0,0,0),
LockMouse = false,
BodyFollow = false
}
CameraService:CreateNewCameraView("2D_test", info) --> Uses info to create a new camera view!
CameraService:LockCameraPanning(true, true, 90, 0)
]]
uiButton.MouseButton1Click:Connect(function()
resetToNormal()
uiButton.Visible = false
CameraService:SetCameraView("ThirdPerson")
CameraService:SetCameraHost() --> Leaving blank will set it back to your character
end)
workspace.WatchPart.ProximityPrompt.Triggered:Connect(function()
resetToNormal()
CameraService:SetCameraHost(workspace.WATCHER)
CameraService:SetCameraView("FirstPerson")
CameraService:Change("LockMouse", false, false)
uiButton.Visible = true
end)
workspace.ThirdPart.ProximityPrompt.Triggered:Connect(function()
resetToNormal()
CameraService:SetCameraView("ThirdPerson")
end)
workspace.DefaultPart.ProximityPrompt.Triggered:Connect(function()
resetToNormal()
CameraService:SetCameraView("Default")
end)
workspace.FirstPart.ProximityPrompt.Triggered:Connect(function()
resetToNormal()
CameraService:SetCameraView("FirstPerson")
end)
workspace.ShakePart.ProximityPrompt.Triggered:Connect(function()
CameraService:Shake(0.5, 5)
end)
workspace.CinematicPart.ProximityPrompt.Triggered:Connect(function()
CameraService:SetCameraView("Cinematic")
CameraService:ChangeSensitivity(0.333)
if player.Character then
player.Character.Humanoid.WalkSpeed = 12
end
game.Lighting.ColorCorrection.Saturation = -0.45
game.Lighting.ColorCorrection.Contrast = 0.45
game.Lighting.DepthOfField.Enabled = true
CameraService:ChangeFOV(90, false)
end)
workspace.ShiftPart.ProximityPrompt.Triggered:Connect(function()
resetToNormal()
CameraService:SetCameraView("ShiftLock")
end)
workspace.TiltPart.ProximityPrompt.Triggered:Connect(function()
CameraService:Tilt(30)
task.wait(5)
CameraService:Tilt(0)
end)
workspace.RotatePart.ProximityPrompt.Triggered:Connect(function()
for i = 1, 360 do
CameraService:Tilt(i)
game:GetService("RunService").PreSimulation:Wait()
end
CameraService:Tilt(0)
end)