On Roblox Studios the camera tween works fine:
But if I play the game on Roblox it does this:
-- Service
local tweenService = game:GetService("TweenService")
-- GUI's Commponets
local openInventoryButton = script.Parent.Parent.InventoryButton
local frame = script.Parent.Parent.InventoryButton.InventoryFrame
local advertiseFrame = script.Parent.Parent.Parent.AdvertiseFrame
local rb_CashFrame = script.Parent.Parent.Parent["RB/CashFrame"]
local storeFrame = script.Parent.Parent.Parent.StoreFrame
-- Workspace
local Target = game.Workspace.Target.CFrame
local homeTarget = game.Workspace.HomeTarget.CFrame
local camPart = game.Workspace.CameraPart
-- Camera
local camera = workspace.CurrentCamera
-- Player
local player = game.Players.LocalPlayer
-- True Values
local notOpen = true
-- Inventory Frames
advertiseFrame.Visible = true
rb_CashFrame.Visible = true
storeFrame.Visible = true
-->>: Open Iventory
local function open()
if notOpen then
-- Slide Camera
camera.CameraType = Enum.CameraType.Scriptable
local newCFrame = CFrame.new(Vector3.new(-5.5, 4.435, -36.605), Target.Position)
local timefortween = 1
tweenService:Create(camera, TweenInfo.new(timefortween), {CFrame = newCFrame}):Play()
frame.Visible = not frame.Visible
advertiseFrame.Visible = not advertiseFrame.Visible
rb_CashFrame.Visible = not rb_CashFrame.Visible
storeFrame.Visible = not storeFrame.Visible
notOpen = false
else
notOpen = true
frame.Visible = not frame.Visible
advertiseFrame.Visible = not advertiseFrame.Visible
rb_CashFrame.Visible = not rb_CashFrame.Visible
storeFrame.Visible = not storeFrame.Visible
-- Slides Camera Back To Origanl Posistion
camera.CameraType = Enum.CameraType.Scriptable
local newCFrame = CFrame.new(Vector3.new(-0.889, 4.435, -36.605), homeTarget.Position)
local timefortween = 1
tweenService:Create(camera, TweenInfo.new(timefortween), {CFrame = newCFrame}):Play()
end
end
-- Calls Functions
openInventoryButton.MouseButton1Click:Connect(open)
CameraHandlerScript:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Mouse = Player:GetMouse()
local prev_mouseHit
local mouseHit = Mouse.Hit.p
local klik = false
Mouse.Button1Up:Connect(function()
klik = false
end)
Mouse.Button1Down:Connect(function()
klik = true
end)
Mouse.Move:Connect(function()
if klik == true then
if Mouse.Hit.p ~= prev_mouseHit then
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.CFrame.p, HumanoidRootPart.CFrame.p + Vector3.new(Mouse.hit.LookVector.x, 0, Mouse.hit.LookVector.y))
prev_mouseHit = mouseHit
end
end
end)
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame