Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why will Enum.CameraType.Custom not connect the camera back the player after the script is ran?

Asked by
Txeer 46
5 years ago
Edited 5 years ago

I am currently working on making a GUI reappear when a player dies and it works perfectly the first time. The second time it works fine except when I tell it to return the camera type to custom, it does make it custom but the camera isn't connected to the player. Any ideas?

Example of what I'm talking about

Script:

01game.ReplicatedStorage.RemoteEvents.PlayButton.OnClientEvent:Connect(function()
02 
03local backpack = game.Players.LocalPlayer.Backpack
04 
05        local looky = game.Workspace.CurrentCamera
06 
07        if backpack:FindFirstChild("Holy Lightning Blade") then
08 
09        storage.RemoteEvents.MobileOn:FireServer()
10 
11        script.Parent.Visible = false
12 
13        repeat wait()
14        looky.CameraType = Enum.CameraType.Custom
15        until looky.CameraType == Enum.CameraType.Custom
View all 90 lines...

(The script broke when I pasted it)

0
I don't see where you're setting the camera type back to the default one for it to lock onto the character MrLonely1221 701 — 5y
0
Look inside one of the elseif blocks, it should be towards the end where it says repeat wait() Txeer 46 — 5y
0
I couldn't remember if Roblox used Custom or a different camera type for attaching to the player. Set the CameraSubject to the player's humanoid in their character MrLonely1221 701 — 5y

1 answer

Log in to vote
0
Answered by
Txeer 46
5 years ago

Thank you MrLonely1221. I solved this by adding a block that changes the camera's subject to the player's humanoid.

1repeat wait()
2looky.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
3until looky.CameraSubject == game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
Ad

Answer this question