I got a camera switcher from a youtube tutorial, but when trying it out I noticed something. The camera doesn’t rotate correctly if the camera part is rotated differently. What happens is that when you turn on the camera, everything is fine and the camera is facing the front (as it should) but when you switch to another camera part (which is rotated differently) and go back to the previous one, it doesn’t face the front anymore!
I’ve tried my best to solve this problem my self before resorting to asking the dev forum, but everytime I try it either breaks the script or changes nothing. Do note that I’m new to scripting cameras, so maybe theres a clear solution that I haven’t tried yet.
script:
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local item = script.Parent.Parent.Parent.Item
local text1 = script.Parent.Parent.TextLabel
local buy = script.Parent.Parent.Buy
local shadow = script.Parent.Parent.Buy.Shadow
local info = script.Parent.Parent.Info
local maximum = script.Parent.Parent.Parent.MaxItem
local minimum = script.Parent.Parent.Parent.MinItem
script.Parent.MouseButton1Click:Connect(function()
if item.Value < maximum.Value then
item.Value = item.Value + 1
camera.CameraSubject = workspace.Shop:FindFirstChild("Cam"..item.Value)
camera:Interpolate(workspace.Shop:FindFirstChild("Cam"..item.Value).CFrame,workspace.Shop:FindFirstChild("Part"..item.Value).CFrame,5)
text1.Text = workspace.Shop:FindFirstChild("Part"..item.Value).ItemName.Value
info.Text = workspace.Shop:FindFirstChild("Part"..item.Value).ItemPrice.Value
elseif item.Value == maximum.Value then
item.Value = minimum.Value
camera.CameraSubject = workspace.Shop:FindFirstChild("Cam"..item.Value)
camera:Interpolate(workspace.Shop:FindFirstChild("Cam"..item.Value).CFrame,workspace.Shop:FindFirstChild("Part"..item.Value).CFrame,5)
text1.Text = workspace.Shop:FindFirstChild("Part"..item.Value).ItemName.Value
info.Text = workspace.Shop:FindFirstChild("Part"..item.Value).ItemPrice.Value
end
end)
I’m only asking on what I should do in order to solve this