I’ve created a psuedo top-down camera for a rogue-like. It works flawlessly in Studio, but when I load up the game in the Roblox Launcher it doesn’t function at all. It’s not even applying the LookAt function, which has me thinking the entire script isn’t even being read. There are no errors that show up in the output in game, nor in Studio. I’ve made sure that the local script is in StarterPlayer.StarterPlayerScripts as well. Here is the local script:
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")
local RP = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Camera = game.Workspace.CurrentCamera
local GeneratedRooms = workspace:WaitForChild("GeneratedRooms")
local CameraSwitchRE = RP.Events.CameraRoomSwitch
Mouse.TargetFilter = GeneratedRooms
local FieldOfView = 60
Camera.CameraType = Enum.CameraType.Scriptable
Camera.FieldOfView = FieldOfView
Camera.CFrame = GeneratedRooms.SpawnRoom.CameraPos.CFrame * CFrame.Angles(math.rad(-50), math.rad(0), math.rad(0))
local RunService = game:GetService("RunService")
RunService.RenderStepped:Connect(function()
if Character then
local MousePos, HRPPos = Mouse.Hit.Position, HRP.Position
local PlayerLookDirection = Vector3.new(
MousePos.X,
HRP.Position.Y,
MousePos.Z
)
HRP.CFrame = CFrame.new(HRPPos, Vector3.new(MousePos.X, HRPPos.Y, MousePos.Z))
end
end)
CameraSwitchRE.OnClientEvent:Connect(function(CameraPos)
local CameraGoal = {}
CameraGoal.CFrame = CameraPos.CFrame * CFrame.Angles(math.rad(-50), math.rad(0), math.rad(0))
local CameraTweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear)
local CameraSwitchTween = TweenService:Create(Camera, CameraTweenInfo, CameraGoal)
CameraSwitchTween:Play()
end)
As stated, not only is it not applying the camera, but its also not applying the HRP CFrame as well. Here is are video examples of the script functioning in Studio, but not in Roblox Launcher:
If any more screenshots or videos are needed, please just request so. Any help is appreciated!