Hello. I am working on a script where a player touches a part, then the camera would be set to a different part.
Here's my script
local CanHit = true
local Camera = workspace.CurrentCamera
script.Parent.Touched:Connect(function(hit)
local h = hit.Parent:FindFirstChild('Humanoid')
if h then
local player = game.Players[hit.Parent.Name]
if player:FindFirstChild('PlayerGui') then
if CanHit == true then
CanHit = false
player.PlayerGui.BlackGui.Frame:TweenSize(UDim2.new(1,0,2,0),'In','Linear',.1)
wait(1)
Camera.CameraType = "Scriptable"
Camera.CameraSubject = workspace.House1CameraPart
hit.Parent:FindFirstChild('HumanoidRootPart').CFrame = CFrame.new(-146.816, 3, -58.368)
wait(1)
player.PlayerGui.BlackGui.Frame:TweenSize(UDim2.new(1,0,1,0),'In','Linear',.1)
CanHit = true
end
end
end
end)
Yea, um. The format is sorta broken, but I hope you can still read it. Any help please? I believe it may the something related with ROBLOX studio.

3 comments
I would change Camera.CameraSubject to Camera.CFrame = ________
Camera.CFrame = workspace.House1CameraPart.CFrame
Yeah, that's what I did, but that didn't work. :(