Yes, it’s inside a MouseButton1Click! Could you rewrite this incorporated into the script as I’m not sure how to add it in. Sorry!
I did. I just added the first few lines of your MouseButton1Click connection into a function, you can just paste the rest.
No, it should be the same script.
local button = script.Parent
local StarterGui = game:GetService("StarterGui")
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
button.MouseEnter:Connect(function()
button:TweenSize(UDim2.new(0, 167,0, 47),"Out","Quad",0.1,true)
end)
button.MouseLeave:Connect(function()
button:TweenSize(UDim2.new(0, 152,0, 39),"Out","Quad",0.1,true)
end)
local function doCameraStuff()
camera.CameraType = "Custom"
camera.CameraSubject = player.Character.Humanoid
camera.CameraType = "Custom"
camera.CFrame = player.Character.Head.CFrame
script.Parent.Visible = false
script.Parent.Parent.Parent.IntroScreen.Frame1.Visible = true
script.Parent.Parent.Parent.IntroScreen.Frame1:TweenSize(UDim2.new(4, 0,4, 0),"Out","Quad",2,true)
wait(0.5)
script.Parent.Parent.Parent.IntroScreen.Frame1.Frame2.Visible = true
wait(0.5)
script.Parent.Parent.Parent.IntroScreen.Frame1.Frame2:TweenSize(UDim2.new(4, 0,4, 0),"Out","Quad",3,true)
wait(0.5)
script.Parent.Parent.Parent.IntroScreen.Frame1.Frame2.Frame3.Visible = true
script.Parent.Parent.Parent.IntroScreen.Frame1.Frame2.Frame3:TweenSize(UDim2.new(4, 0,4, 0),"Out","Quad",3,true)
wait(1)
script.Parent.Parent.Parent.IntroScreen.Welcome.Visible = true
wait(1.5)
script.Parent.Parent.Parent.IntroScreen.Kool.Visible = true
script.Parent.Parent.Parent.IntroScreen.Kafe.Visible = true
wait(0.5)
script.Parent.Parent.Parent.IntroScreen.TextLabel.Visible = true
script.Parent.Parent.Parent.IntroScreen.TextLabel.Text = ("Loading Assets... (1/3)")
wait(1)
script.Parent.Parent.Parent.IntroScreen.TextLabel.Text = ("Loading Assets... (2/3)")
wait(2)
script.Parent.Parent.Parent.IntroScreen.TextLabel.Text = ("Loading Assets... (3/3)")
wait(3)
script.Parent.Parent.Parent.IntroScreen.Frame1:TweenSize(UDim2.new(0.01, 0,0.01, 0),"Out","Quad",2,true)
wait(0.5)
script.Parent.Parent.Parent.IntroScreen.Kafe.Visible = false
script.Parent.Parent.Parent.IntroScreen.Kool.Visible = false
script.Parent.Parent.Parent.IntroScreen.Welcome.Visible = false
script.Parent.Parent.Parent.IntroScreen.TextLabel.Visible = false
wait(0.5)
script.Parent.Parent.Parent.AllGui.Enabled = true
script.Parent.Parent.Parent.Point.Enabled = true
wait(1)
game.StarterGui.IntroGUI:Destroy()
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
player.PlayerGui.IntroScreen:Destroy()
end
game:GetService('Players').LocalPlayer.CharacterAdded:Connect(doCameraStuff)
script.Parent.MouseButton1Click:Connect(doCameraStuff)
My bad, forgot to remove the parentheses at the end. I made an edit that should work.
Didn’t work. No errors for the script specifically, although I’m not sure which one it is out of these:
My bad again, I made an edit to that post. Should work now.
The button works now but the camera doesn’t reset to the player; I don’t see any errors.
Does it work when you press the button or no?
No, it doesn’t reset the camera.
I’m confused as to what you mean by reset the camera. You want it to be type custom and the CameraSubject to be the humanoid?
Yep. I want it to go from viewing a CFrame position somewhere else in the building back to viewing the humanoid of the player.
Well the script I gave you is only going to whatever clicking the button does. That isn’t what you want?
I’m not sure how else to explain it, sorry for confusing you. It’s quite self explanatory, so the camera will be viewing a certain CFrame position in my game which isn’t the player’s humanoid, when the button is pressed I want the player’s CFrame position to view the player’s humanoid again as usual, as the camera would be at all times throughout the game. The “default” camera view, if that makes sense.
Oh okay, I see. You will have to create a separate function that changes the cameratype to scriptable then set the camera’s CFrame to that desired CFrame. Then do whatever you have to do to tween it to the humanoid as I think that’s what you are trying to explain. Then you use a .CharacterAdded event to connect it to the function whenever the player’s character is added.
Do you have the script(s) for this? If not, no worries. I’ll need to figure it out.
I don’t, sorry. Don’t think you provided it either. It should just be whatever sets the camera initially when the player joins.
Okay, I’ll look in to it, thank you.
This worked in the end, thank you!