My coding experience is very low so please explain with detail if possible!
So, I look up a tutorial on how to move the camera where ever your mouse is (which works) and I have a tiny problem because I’m trying to switch up the cameras to one of my parts. (I have parts as cameras)
Camera Parts:
Code:
local soundservice = game:GetService("SoundService")
local tweenservice = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local menucamera = workspace.CameraScenes.MenuCamera
local shopcamera = workspace.CameraScenes.ShopCamera
local certaincamera = workspace.CurrentCamera
certaincamera.CameraType = Enum.CameraType.Scriptable
local MOVE_SPEED = 150
local function UpdateCamera()
local Center = menucamera.CFrame
local MoveVector = Vector3.new((Mouse.X - Center.X)/MOVE_SPEED, (Mouse.Y - Center.Y)/MOVE_SPEED, 0)
certaincamera.CFrame = menucamera.CFrame * CFrame.Angles(math.rad(-(Mouse.Y - Center.Y)/MOVE_SPEED), math.rad(-(Mouse.X - Center.Y)/MOVE_SPEED), 0)
end
local Connection = RunService.RenderStepped:Connect(UpdateCamera)
local fade = script.Parent.Frame.Fade
local credittext = script.Parent.Frame.credits.TextLabel
local settingtext = script.Parent.Frame.settings.TextLabel
local playtext = script.Parent.Frame.play.TextLabel
local shoptext = script.Parent.Frame.shop.TextLabel
local credit = script.Parent.Frame.credits
local setting = script.Parent.Frame.settings
local play = script.Parent.Frame.play
local shop = script.Parent.Frame.shop
local title = script.Parent.Frame.TITLENAME
--mouse enter's
play.MouseEnter:Connect(function()
soundservice.MouseSounds.ButtonHover:Play()
play.TextColor3 = Color3.fromRGB(255,170,0)
playtext.Visible = true
end)
play.MouseLeave:Connect(function()
play.TextColor3 = Color3.fromRGB(255,255,255)
playtext.Visible = false
end)
play.MouseButton1Up:Connect(function()
certaincamera.CFrame = menucamera.CFrame
end)
setting.MouseEnter:Connect(function()
soundservice.MouseSounds.ButtonHover:Play()
setting.TextColor3 = Color3.fromRGB(255,170,0)
settingtext.Visible = true
end)
setting.MouseLeave:Connect(function()
setting.TextColor3 = Color3.fromRGB(255,255,255)
settingtext.Visible = false
end)
shop.MouseEnter:Connect(function()
soundservice.MouseSounds.ButtonHover:Play()
shop.TextColor3 = Color3.fromRGB(255,170,0)
shoptext.Visible = true
end)
shop.MouseLeave:Connect(function()
shop.TextColor3 = Color3.fromRGB(255,255,255)
shoptext.Visible = false
end)
credit.MouseEnter:Connect(function()
soundservice.MouseSounds.ButtonHover:Play()
credit.TextColor3 = Color3.fromRGB(255,170,0)
credittext.Visible = true
end)
credit.MouseLeave:Connect(function()
credit.TextColor3 = Color3.fromRGB(255,255,255)
credittext.Visible = false
end)
--mouse click
shop.MouseButton1Click:Connect(function()
certaincamera.CFrame = shopcamera.CFrame
end)
I tried switching the CFrame you can see it in “shop.MouseButton1Click:Connect(function()” and “play.MouseButton1Up:Connect(function()”