I'm sorry for having the last post not make sense, this might help more because I've found the issue.
For some reason, when I try to set workspace.CurrentCamera.CameraType
to Enum.CameraType.Custom
it doesn't seem to reset the camera position to the player. It just stays at the same position as before. Also, setting the CameraSubject to the players Humanoid also does nothing. Please, someone help I'm getting tired of this not working. Here is my LOCALSCRIPT.
local TweenService = game:GetService("TweenService") local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable function CameraMove(pos1, tweenbool) local spd = 0 if tweenbool == true then spd = 5 end local info, posnx = TweenInfo.new( spd, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0 ), { CFrame = pos1 } local tween = TweenService:Create(camera, info, posnx) camera.CameraType = Enum.CameraType.Scriptable tween:Play() end player.CharacterAdded:Wait() CameraMove(workspace.Camera1.CFrame, true) game.ReplicatedStorage.Events.BindableEvents.PlayerPressedPlay.Event:Connect(function() camera.CameraType = Enum.CameraType.Custom end)
You need to do both, camera type to custom
and subject to humanoid
. Also you need to make sure the humanoid reference is valid (player may have respawned).
game.ReplicatedStorage.Events.BindableEvents.PlayerPressedPlay.Event:Connect(function() print("If you can see this, it means your event is firing properly") camera.CameraType = Enum.CameraType.Custom local newChar = player.Character or player.CharacterAdded:Wait() camera.CameraSubject = newChar:WaitForChild("Humanoid") end)
It goes without saying, that you should check if your event is firing (I added a print).
Edit:
I just noticed you are using a BindableEvent
and not RemoteEvent
. Local bindable events should not be in the ReplicatedStorage
, as they do not need to be replicated to server. You should keep them locally, for example in the StarterPack
.
I FINALLY FIXED IT! Sorry for the inconvenience, alas it was a STUDIO bug. Delete your script and ctrl c + ctrl v your script into the new one. Hope this helps.