You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I’m trying to make it so that the player can go through a selection of morphs with a GUI menu and camera movement.
What I’m trying to script right now is that when you press the arrow buttons, the camera moves to the next character using the cameras placed in front of them. I have a folder of 8 camera positions and can only get it to go to the first one when you open the menu, before it locks and refuses to move to the next camera.
I have set the camera to Custom after the script and even changed its location in the script multiple times, or rewrote everything entirely, and still can’t get it to work. I’m not experiences with these kinds of things and am still learning, but i’ve been digging through the forum so much and haven’t found anything that worked. Unfortunately it’s not printing any errors either.
UI OPENS:
local button = script.Parent
local frame = script.Parent.Parent.Parent
local morphMenu = script.Parent.Parent.Parent.Parent.MorphUI
button.MouseButton1Up:Connect(function()
script.Parent.ClickSound:Play()
frame.Visible = false
morphMenu.Visible = true
local camera = workspace.CurrentCamera -- finds the camera
local Run = game:GetService("RunService")
local part = workspace.MorphLobby.CameraPositions:WaitForChild("Cam Position 1") -- name of my camera part
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = part
local function OnChanged()
camera.CFrame = part.CFrame
wait()
end
Run.RenderStepped:Connect(OnChanged)
end)
.
.
BUTTON IS PRESSED TO CHANGE CAMERA:
local button = script.Parent
local catnap = script.Parent.Parent
local dogday = script.Parent.Parent.Parent.Dogday
button.MouseButton1Up:Connect(function()
script.Parent.ClickSound:Play()
catnap.Morph.Visible = false
catnap.Next.Visible = false
catnap.Previous.Visible = false
catnap.CTNP.Visible = false
catnap.CTNPinfo.Visible = false
dogday.Morph.Visible = true
dogday.Next.Visible = true
dogday.Previous.Visible = true
dogday.DGDY.Visible = true
dogday.DGDYinfo.Visible = true
local camera = workspace.CurrentCamera -- finds the camera
local Run = game:GetService("RunService")
local part = workspace.MorphLobby.CameraPositions:WaitForChild("Cam Position 2") -- name of camera part
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = part
local function OnChanged()
camera.CFrame = part.CFrame
wait()
end
Run.RenderStepped:Connect(OnChanged)
camera.CameraType = Enum.CameraType.Custom
end)
.
.
If anyone can help me figure this out i’d greatly appreciate it.
Try doing something like this
(I am assuming that you use 1 button to change the camera to the next morphs and then change it back to 1 from 8 and do the samen thing again, if that is the case then each cam part should be named by number,from 1 to 8)
local ts=game:GetService"TweenService"
local YourFolder=--path to the folder of cam parts
local cam=workspace.CurrentCamera
local tweeninfo=TweenInfo.new(.5,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
local YourButton=--path to your button
local currentcam=0
YourButton.MouseButton1Click:Connect(function()
cam.CameraType=Enum.CameraType.Scriptable
currentcam+=1
if currentcam>8 then currentcam=1 end
ts:Create(cam,tweeninfo,{CFrame=YourFolder[currentcam].CFrame}):Play()
end)
Not sure if I did this wrong, but it sets the camera to the first position when the UI opens then moves to a separate script in the button where it then switches between the cameras. I put this in the next button as I assume that’s where you meant for it to go but it isn’t working. Was there something else I was supposed to do?
local ts=game:GetService"TweenService"
local tinfo=TweenInfo.new(.5,Enum.EasingStyle.Back,Enum.EasingDirection.Out)
local camera=workspace.CurrentCamera
local camFolder=--[[
Path to the camparts Folder, the name of camparts should be like this
1 --first campart
2
3
4
5
6
7
8 --last campart
]]
local perviousButton=--path to the pervious button
local MenuButton=--path to the MenuButton (Note : this is an example, you may like to use PP or whatever but the script we connect to it does not need a huge change
local NextButton=--path to the nextbutton
local EquipButton= -- path to the equip button, you already know what it should do
local ExitButton=--path to the exit button
local value=0
local rigs={ -- edit this, for example if cam 1 is for rig1 then write the name of the rig1 in [1] index
[1]="CatNap",
[2]="Huggy",
[3]="Kissy",
[4]="nightmare huggy",
[5]="idk",
[6]="still idk",
[7]="<_>",
[8]="uh"
}
MenuButton.MouseButton1Click:Connect(function()
camera.CameraType=Enum.CameraType.Scriptable
ts:Create(camera,tinfo,{CFrame=camFolder:FindFirstChild("1").CFrame}):Play()
-- you can set the visiblity of the buttons you need to true
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)
perviousButton.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()
camera.CameraType=Enum.CameraType.Fixed
-- set the visiblity of the pervious,next,exit and equip buttons to false or whatever you like
-- idk man, do whatever you want
end)
yeah, unfortunately it gave me an error. i did also disable the script in the morph menu button temporarily to see if that was messing with it but i got the same results with the menu not opening.
ohhh my bad it does work, i must have forgot to save earlier when i closed studio even though i thought i did. i shouldve checked, my bad. thank you so much for the help!