Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Problem with my intro camera script?

The button stays at the point it's at when clicked and the camera also still keeps circling the camerapart. Why is that?

Note: This is inside a localscript.

Error: MouseButton1Down is not a valid member of TextLabel (Line 17)

local camerapart = Instance.new("Part")
camerapart.Parent = workspace
camerapart.Anchored = true
camerapart.CanCollide = false
camerapart.Transparency = 1
camerapart.Position = Vector3.new(0, 20, 0)

local target = camerapart
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0
local disabled = false

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
	disabled = true
end)

while true do
    if not disabled then
        camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 20)
        angle = angle + math.rad(0.7)
		player.Character.Humanoid.WalkSpeed = 0
	elseif disabled then
		break
	end
	disabled = true
    game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    game.Workspace.CurrentCamera.CameraType = "Custom"
	script.Parent:TweenPosition(UDim2.new(0, 0, 10, 0), "Out", "Quad", 2.5)
	player.Character.Humanoid.WalkSpeed = 0
    game:GetService("RunService").RenderStepped:wait()
end

1 answer

✓ Accepted answer

You're trying to detect clicks in a TextLabel, which does not have the ability to detect clicks. Try finding a way to substitute a button of some sort into this code instead.

This discussion is preserved as it was. New answers, comments, and votes are closed.