This worked before but I’m not sure why it doesn’t anymore. I hadn’t added any scripts or anything since.
Basically, I have a GUI for morphs where when you press the morph button it sends the camera to a camera part in a room with these morphs, where you can then press a button to go back and fourth between the characters using the set camera position parts. I finally got the movement to work but now when you select morph it gets stuck on the screen. It DOES morph your character but when setting the camera to custom, it doesn’t set it in game. I’ve tried adding it to the head, the humanoid, even moving it back and fourth between the movement and morph script but nothing has worked.
CAMERA MOVEMENT SCRIPT:
local ts=game:GetService"TweenService"
local tinfo=TweenInfo.new(.5,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
local camera=workspace.CurrentCamera
local camFolder=workspace.MorphLobby.CameraPositions
local previousButton=script.Parent.Parent.Previous --path to the pervious button
local MenuButton=script.Parent.Parent.Parent.Frame.PhoneOn.App1 --path to the MenuButton
local NextButton=script.Parent --path to the nextbutton
local EquipButton=script.Parent.Parent.Catnap.Morph -- path to the equip button
local ExitButton=script.Parent.Parent.Catnap.Morph--path to the exit button
local value=0
local rigs={ --if cam 1 is for rig1 then write the name of the rig1 in [1] index
[1]="Catnap",
[2]="Dogday",
[3]="Hoppy",
[4]="Bobby",
[5]="Kickin",
[6]="Bubba",
[7]="Picky",
[8]="Crafty"
}
MenuButton.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = true
script.Parent.Parent.Parent.Frame.Visible = false
camera.CameraType=Enum.CameraType.Scriptable
ts:Create(camera,tinfo,{CFrame=camFolder:FindFirstChild("1").CFrame}):Play()
end)
NextButton.MouseButton1Click:Connect(function()
value+=1
if value>8 then value=1 end
ts:Create(camera,tinfo,{CFrame=camFolder:FindFirstChild(value).CFrame}):Play()
print(rigs[value])
end)
previousButton.MouseButton1Click:Connect(function()
value-=1
if value<1 then value=8 end
ts:Create(camera,tinfo,{CFrame=camFolder:FindFirstChild(value).CFrame}):Play()
print(rigs[value])
end)
ExitButton.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.Frame.Visible = true
camera.CameraType=Enum.CameraType.Custom
end)
MORPH SCRIPT:
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.CharChange:FireServer(game.ReplicatedStorage.Morphs.Catnap)
local cc = workspace.CurrentCamera
local CameraPart = workspace.CameraPart
cc.CameraSubject = game:GetService("Players").LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
cc.CameraType = Enum.CameraType.Custom
end)
As started before these have been edited back and fourth multiple times before I just gave up and called it a day. Figured I’d try again and ask for help so some stuff may still be there that shouldn’t. I’d appreciate the help.
I will also mention that setting the camera to custom manually in studio when testing, the morph is there at least and works (the camera stays in place while the character moves but I mean thats expected since I didn’t set it to the player manually), so everything works fine except moving the camera back to the player when morphed.
I can only assume that you - during the player’s character swapping to the morph - have possibly displaced or misdirected the path to the proper humanoid. To check where it goes into the mist, make sure to add a print() statement after every property change of the camera to verify that your code is functioning (or where it isn’t). Most useful is probably after the final lines of your morph script, where you print the CameraSubject and the CameraType. Perhaps the morph gives the player a different character, thus using the LocalPlayer.Character path becomes redundant, but that’s just an assumption since I have no clue how the character morphing has been handled.
Since you list your CameraSubject using the function :FindFirstChildOfClass() to find a Humanoid, maybe you can input to find a part like so: :FindFirstChildOfClass("Part") to attach itself to any part in the LocalPlayer.Character.
Hm, nothing seems to be printing from the morph script and im not sure why. This script worked before I got the camera working when sliding to each cam position for the morphs. So I assume both scripts are fine but clashing somehow causing the morph script to not work? I’ve never seen a problem like this before.
Okay after messing with the script for what seems like forever, I noticed that once them menu opens, the camera position is ONLY able to be changed then. Once you hit the other functions where it begins tweening or you morph, it’s no longer able to be changed.
-- CAMERA
local player = game:GetService("Players").LocalPlayer
local ts = game:GetService"TweenService"
local tinfo = TweenInfo.new(.5,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
local camera = workspace.CurrentCamera
local camFolder = workspace.MorphLobby.CameraPositions
local MenuButton = script.Parent.Parent.Parent.Frame.PhoneOn.App1 --path to the MenuButton
local NextButton = script.Parent --path to the nextbutton
local PreviousButton = script.Parent.Parent.Previous --path to the pervious button
local value=0
local rigs={ --if cam 1 is for rig1 then write the name of the rig1 in [1] index
[1]="Catnap",
[2]="Dogday",
[3]="Hoppy",
[4]="Bobby",
[5]="Kickin",
[6]="Bubba",
[7]="Picky",
[8]="Crafty"
}
-- OPEN UI
MenuButton.MouseButton1Click:Connect(function()
MenuButton.ClickSound:Play()
script.Parent.Parent.Visible = true
script.Parent.Parent.Parent.Frame.Visible = false
camera.CameraType=Enum.CameraType.Scriptable
ts:Create(camera,tinfo,{CFrame=camFolder:FindFirstChild("1").CFrame}):Play()
end)
-- SWITCH CHARACTER CAMERAS
NextButton.MouseButton1Click:Connect(function()
value+=1
if value>8 then value=1 end
ts:Create(camera,tinfo,{CFrame=camFolder:FindFirstChild(value).CFrame}):Play()
print(rigs[value])
end)
PreviousButton.MouseButton1Click:Connect(function()
value-=1
if value<1 then value=8 end
ts:Create(camera,tinfo,{CFrame=camFolder:FindFirstChild(value).CFrame}):Play()
print(rigs[value])
end)
-- CHARACTER MORPHING
local CTNPEquipButton=script.Parent.Parent.Catnap.Morph -- path to the equip button
CTNPEquipButton.MouseButton1Click:Connect(function()
camera.CameraType=Enum.CameraType.Custom
game.ReplicatedStorage.CharChange:FireServer(game.ReplicatedStorage.Morphs.Catnap)
end)
I have updated it and it still doesn’t work, so I’m not entirely sure where to go about fixing it from here. I removed every other script so that everything is in one place. I can get everything to work, but the camera can only go back to the player when the menu is opened, it does not seem to work elsewhere.
Okay final update, I figured it out. The path to the buttons was correct but it seemed to work better when all buttons were in the same location (thankfully). SO I’ll go ahead and mark this as solved.