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

Problem with my intro camera script?

Asked by
Relatch 550 Moderation Voter
9 years ago

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

Log in to vote
2
Answered by
RoboFrog 400 Moderation Voter
9 years ago

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.

Ad

Answer this question