Vargogram
(Muffins)
August 26, 2020, 7:01pm
#1
Trying to set the Camera’s CFrame via Remote Event.
Local Script
function SetCameraPos(object, Status)
local cam = workspace:WaitForChild("Camera")
cam.CameraType = Status
cam.CFrame = object.CFrame
end
--[[local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 12
local tweenInfo = TweenInfo.new(
cutsceneTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
function tween(part1, part2, cutsceneTime)
local tweenInfo = TweenInfo.new(
cutsceneTime,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part1.CFrame
local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
tween:Play()
wait(cutsceneTime)
camera.CameraType = Enum.CameraType.Custom
end
game.ReplicatedStorage.Cutscene.OnClientEvent:Connect(function(startPt, endPt, timeLength)
tween(startPt, endPt, timeLength)
end)--]]
game.ReplicatedStorage.SetCameraCFrame.OnClientEvent:Connect(function(obj,Stats)
SetCameraPos(obj, Stats)
end)
Server Script
game.Players.PlayerAdded:Connect(function(plr)
game.ReplicatedStorage.SetCameraCFrame:FireClient(plr, workspace.Camera1, Fixed)
wait(5)
--[[game.ReplicatedStorage.Cutscene:FireClient(plr, workspace.Camera1, workspace.Camera2, 15)
wait(15)]]--
end)
It says in the output that it’s an invalid value for enum CameraType. Is there anything that I’m doing wrong here? There’s also an orange line under ‘Fixed’ in line 2 of the Server Script. So maybe it has to do with that?
cam.CameraType = Status
Should be
cam.CameraType = Enum.CameraType.TYPE
remove the Arg: “Status” and change TYPE to ur camera type preference
In this case:
cam.CameraType = Enum.CameraType.Fixed
Would be it
Vargogram
(Muffins)
August 26, 2020, 7:07pm
#3
Right, but I also wanna run the same remote event to change it to Custom cameratype.
Okay. So where is the Arg: “Status” coming from?
Vargogram
(Muffins)
August 26, 2020, 7:08pm
#5
Discgolftaco231:
Status
Sending it from the remote event from the server all the way to the func
should we continue in dms to not spam
Try to make Status as two variables in the SetverScript like this:
local StatusFixed = Enum.CameraType.Fixed
local StatusCustom = Enum.CameraType.Custom
Make both those variables an Arg in the ServerScript when u fire the client.
In the LocalScript, instead of a “Status” Arg, carry over the two new Args and put them in the local script.
Then use the ServerScript to switch between both by using
else
Or something similar.
Make sure u change “Status” in the ServerScript to the corresponding Variables.
1 Like
Vargogram
(Muffins)
August 26, 2020, 7:19pm
#7
Like this?
local MakeCamScriptable = Enum.CameraType.Scriptable
local MakeCamCustom = Enum.CameraType.Custom
game.Players.PlayerAdded:Connect(function(plr)
game.ReplicatedStorage.SetCameraCFrame:FireClient(plr, workspace.Camera1, MakeCamScriptable)
wait(5)
--[[game.ReplicatedStorage.Cutscene:FireClient(plr, workspace.Camera1, workspace.Camera2, 15)
wait(15)]]--
end)
game.ReplicatedStorage.typewriter:FireAllClients("This text is for the typewriter tutorial.", 0.05)
(tried this didn’t work)
Ender_BX
(Ender_BX)
August 26, 2020, 7:36pm
#8
you can simply replace
cam.CameraType = Status
to:
cam.CameraType = Enum.CameraType[Status]
This should fix your issue
2 Likes
Vargogram
(Muffins)
August 26, 2020, 8:37pm
#9
I tried that and it didn’t work…
Styre_x
(Styrex)
August 26, 2020, 8:59pm
#10
change cam.CameraType = Status
to cam.CameraType = Enum.CameraType[Status]
and make Fixed
in the server script a string like "Fixed"
.
Alternatively you could just send "Fixed"
or Enum.CameraType.Fixed
and leave it as that, as a cameratype doesn’t need to be an enum.
Vargogram
(Muffins)
August 26, 2020, 9:06pm
#11
Tried every option and it’s not working. IQ dropping fast.
Ender_BX
(Ender_BX)
August 26, 2020, 10:35pm
#12
what is not functioning?
Did you send Status
as a string
?
1 Like